[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]

Re: [pygame] Why does Rect and Surface have copy method when copy exist in std-lib?



What we've established so far:

- copy.copy is considered an import "hurdle"
- which is why many modules implement a .copy() function to
- both of which basically wrap an internal .__copy__() function whose
direct use appears to be discouraged

At the end of the day I think you should decide what your code needs
to do: if copying an object or resource is a natural thing to do you
want to provide for your users, implement a __copy__ function. Adding
a line copy = __copy__ underneath would hence be a good thing to do to
encourage and ease use. In some cases, a copy of an object may be
nontrivial to create or, for example with system resource you rather
want to not provide anything like it, don't provide __copy__ and skip
this part.

cheers!
mar77i