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
>

Reply via email to