[ python-Bugs-1068590 ] confusing new method names for lists

SourceForge.net noreply at sourceforge.net
Wed Nov 24 08:28:25 CET 2004


Bugs item #1068590, was opened at 2004-11-18 05:51
Message generated for change (Comment added) made by tjreedy
You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=105470&aid=1068590&group_id=5470

Category: Python Interpreter Core
Group: Python 2.4
Status: Closed
Resolution: Wont Fix
Priority: 3
Submitted By: McErnie (mcernie)
Assigned to: Nobody/Anonymous (nobody)
Summary: confusing new method names for lists

Initial Comment:
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.

----------------------------------------------------------------------

Comment By: Terry J. Reedy (tjreedy)
Date: 2004-11-24 02:28

Message:
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.  

----------------------------------------------------------------------

Comment By: Raymond Hettinger (rhettinger)
Date: 2004-11-18 08:54

Message:
Logged In: YES 
user_id=80475

Sorry, the names were discussed at length on python dev and
these were found to be the best.

----------------------------------------------------------------------

Comment By: McErnie (mcernie)
Date: 2004-11-18 06:12

Message:
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.

----------------------------------------------------------------------

You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=105470&aid=1068590&group_id=5470


More information about the Python-bugs-list mailing list