[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
RE: [pygame] Newb question: copies vs references
- To: pygame-users@seul.org
- Subject: RE: [pygame] Newb question: copies vs references
- From: Jan Ekholm <chakie@infa.abo.fi>
- Date: Tue, 2 Apr 2002 10:19:13 +0300 (EEST)
- Delivered-To: archiver@seul.org
- Delivered-To: pygame-users-outgoing@seul.org
- Delivered-To: pygame-users@seul.org
- Delivery-Date: Tue, 02 Apr 2002 02:19:17 -0500
- In-Reply-To: <DHEEKAFNPOKNEBEBLCIAGENFCIAA.vimakefile@yahoo.com>
- Reply-To: pygame-users@seul.org
- Sender: owner-pygame-users@seul.org
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