[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

RE: [pygame] Newb question: copies vs references



On Wed, 27 Mar 2002, Michael Robin wrote:

>import copy
>
>y = copy.copy(y)
> for a "shallow copy" (one-level)
> or
>y = copy.deepcopy(y),
> if you want to recursively copy all elements.

As long as no member in the deepcopied object is a Surface. I did some
deepcopying, and as Surface:s were/are not deepcopyable I got an error. I
solved it by overriding the method __deepcopy__() for the class with the
surface and made sure that the surface was shared among instances, not
copied.

1.4 may have changed that behaviour, I haven't tested.

-- 
  +++ Divide By Cucumber Error. Please Reinstall Universe And Reboot +++
                                        -- Terry Pratchett, Hogfather

____________________________________
pygame mailing list
pygame-users@seul.org
http://pygame.seul.org