# File lib/RMagick.rb, line 1293
    def replace(other)
        is_a_image_array other
        # Since replace gets called so frequently when @scene == nil
        # test for it instead of letting rescue catch it.
        cfid = nil
        if @scene then
            cfid = self[@scene].__id__ rescue nil
        end
        super
        # set_cf will fail if the new list has fewer images
        # than the scene number indicates.
        @scene = self.length == 0 ? nil : 0
        set_cf cfid
        self
    end