Rect should have a copy method

illume avatarillume created an issue

Nick Welch, 2008-11-21 01:36:44 -0800

The unofficial way, which seems to be in some old documentation cached by google but not in any of the actual documentation anymore, is to do myrect.move(0, 0).  This is non-obvious and mysteriously undocumented now.  A Rect.copy() method is much clearer and should be trivial to implement.

Nick Welch, 2008-11-21 01:40:46 -0800

Also, Rect(myrect) to do a copy is inconvenient because then it requires an import of Rect in every source file that you want to copy rects in.  A Rect.copy() would lift that requirement, and is in line with Python style, e.g. dict.copy().

Nick Welch, 2008-11-21 01:48:55 -0800

Err... ok, looking through the docs, there is a copy function available as __copy__ which copy.copy() will use.  So why not just make it Rect.copy() as dict does?

Lenard Lindstrom, 2009-02-12 12:50:07 -0800

More relevant, it is consistent with Surface.copy.
Added in revision 1924.

Comments (0)

  1. Log in to comment
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.