[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]
Re: [pygame] Sprite Collision
- To: pygame-users@xxxxxxxx
- Subject: Re: [pygame] Sprite Collision
- From: Greg Ewing <greg.ewing@xxxxxxxxxxxxxxxx>
- Date: Wed, 02 May 2007 13:12:40 +1200
- Delivered-to: archiver@seul.org
- Delivered-to: pygame-users-outgoing@seul.org
- Delivered-to: pygame-users@seul.org
- Delivery-date: Tue, 01 May 2007 21:15:55 -0400
- In-reply-to: <4636B40F.3040900@xepher.net>
- References: <4635F578.7010701@speakeasy.net> <3F368A88-D519-4F3A-9F66-721451F02622@pandora.com> <f1186df40704301650r760fa07elc1dae75140710780@mail.gmail.com> <4636854C.6090906@cs.rpi.edu> <4636B40F.3040900@xepher.net>
- Reply-to: pygame-users@xxxxxxxx
- Sender: owner-pygame-users@xxxxxxxx
- User-agent: Mozilla Thunderbird 1.0.5 (Macintosh/20050711)
Kris Schnee wrote:
When all else fails, copy.deepcopy() seems to make Python understand, "I
want this to have _the same value_ as X now has, not to be a _reference_
to X."
I'd advise against using deepcopy() in a desperate
attempt to make Python "seem to understand" something.
That wording suggests more that there's something *you*
don't understand about how your program works or is
supposed to work.
Personally I don't find deepcopy() much use at all,
because usually when you want more than a shallow
copy you want something less than a fully deep copy.
For instance, if you have a 2d list of tiles, you
want to copy 2 levels deep, but not copy the tiles
themselves. And I'd be somewhat uncertain what
deepcopy() would do if I let it loose on my tile
objects.
So I tend to be more comfortable writing my own
copying functions tailored to specific circumstances.
I don't think I've ever used deepcopy() or felt any
need to use it.
--
Greg