Yes, I have seen that. There is a bunch of other libraries that does it as well, such as numpy.copy pandas.DataFrame.copy.
The reason why I ask is that I have a library (pymunk) where I just implemented pickle support, and I now have the option to either be satisfied with copy.deepcopy which comes for free from pickle, or add a custom copy method just like pygame has done. To me it seems like having a custom copy goes against the python zen "There should be one-- and preferably only one --obvious way to do it.". At the same time many libraries have custom copy method, just as you noted. On Sat, Jun 3, 2017 at 11:26 PM, Daniel Foerster <pydsig...@gmail.com> wrote: > Allow me to point out that there's such a thing as dict.copy(). It's > pointless to import a module to call a method that you know is made > publicly available already, and just as pointless to make people import. > > On Jun 3, 2017 16:23, "Victor Blomqvist" <v...@viblo.se> wrote: > >> It seems like such a small performance difference shouldnt affect the >> decision if a custom copy method is good or not? >> >> /Victor >> >> On Thu, Jun 1, 2017 at 9:24 PM, Jason Marshall < >> jasonmarshall...@gmail.com> wrote: >> >>> In the C code, rect.copy and surface.copy are equivalent to >>> rect.__copy__ and surface.__copy__. You may use copy.copy(rect) and >>> copy.copy(surface) in your code, but copy.copy will simply call >>> rect.__copy__ or surface.__copy__. By using rect.copy and surface.copy >>> rather than the standard library's copy.copy, your code will run >>> ≈0.0001% faster. >>> >>> For aesthetic reasons, you would use rect.copy and surface.copy rather >>> than rect.__copy__ and surface.__copy__ in your code. >>> >>> Jason >>> >>> On Mon, May 29, 2017 at 3:38 PM, Victor Blomqvist <v...@viblo.se> wrote: >>> > Hello, >>> > >>> > Something I have been thinking about: >>> > Rect and Surface classes have their own copy methods. Why do they have >>> that >>> > when there is a module called copy in the standard lib that can handle >>> copy >>> > (with help)? The rect copy method was added in pygame 1.9 so it is >>> fairly >>> > recent. >>> > >>> > http://pygame.org/docs/ref/rect.html#pygame.Rect.copy >>> > https://docs.python.org/2/library/copy.html >>> > >>> > Thanks for any insights! >>> > /Victor >>> >> >>