This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

classification
Title: confusing new method names for lists
Type: Stage:
Components: Interpreter Core Versions: Python 2.4
process
Status: closed Resolution: wont fix
Dependencies: Superseder:
Assigned To: Nosy List: mcernie, rhettinger, terry.reedy
Priority: low Keywords:

Created on 2004-11-18 10:51 by mcernie, last changed 2022-04-11 14:56 by admin. This issue is now closed.

Messages (4)
msg23188 - (view) Author: McErnie (mcernie) Date: 2004-11-18 10:51
The names of two new list methods lead to confusion:
sorted() - returns a sorted copy of the list
reversed() - returns a reverse-traveling iterator

In my opinion, reversed() should return a reversed copy
of the list.

backward() seems a good name for a method that returns
a reverse-traveling iterator.
msg23189 - (view) Author: McErnie (mcernie) Date: 2004-11-18 11:12
Logged In: YES 
user_id=1075992

Oops, I misread the 'New or upgraded built-ins'. reversed()
is the reverse of iter().

The confusion does stick, however.

Pasted tenses should be used for methods delivering a
completed result. Nouns and present tenses for objects. As
reversed() returns an object, reviter() (alternative from
PEP 322) is far more logical.
msg23190 - (view) Author: Raymond Hettinger (rhettinger) * (Python committer) Date: 2004-11-18 13:54
Logged In: YES 
user_id=80475

Sorry, the names were discussed at length on python dev and
these were found to be the best.
msg23191 - (view) Author: Terry J. Reedy (terry.reedy) * (Python committer) Date: 2004-11-24 07:28
Logged In: YES 
user_id=593130

For future reference: a 'bug', for the purpose of this trackers, 
is missing documentation (that should be present) of a 
discrepancy between the doc and the behavior of the 
CPython implementation.

Design opinions belong on comp.lang.python or python-list 
or, when timely, on the development list.  If you had posted 
this there, someone would most likely have given you the 
context that Python is shifting from a list orientation to an 
iterator orientation.  In the future, builtin map, which returns 
a list, might, for instance, be replaced by itertools.imap, 
which returns an iterator.  Someone who needed a manifest 
collective object could then pass the iterator to the 
corresponding constructor.  
History
Date User Action Args
2022-04-11 14:56:08adminsetgithub: 41189
2004-11-18 10:51:51mcerniecreate