What about an EXPLICIT naming scheme for built-ins?

David Fraser davidf at sjsoft.com
Fri Sep 3 21:52:40 CEST 2004


Marco Aschwanden wrote:
> I just read the changes for 2.4 and while scanning the list the past 
> tense built-ins got my attention:
> 
> sorted() - a new builtin sorted() acts like an in-place list.sort() but 
> can be used in expressions, as it returns a copy of the sequence, sorted.
> 
> reversed() - a new builtin that takes a sequence and returns an iterator 
> that loops over the elements of the sequence in reverse order (PEP 322)
> 
> 
> sort() works in-place.
> reverse() works in-place.
> 

How about reversed() returning a sequence, like sorted does, but adding 
an iterator function called riter or reverseiter to iterate over 
sequences in reverse order. That would then be similar to the iter 
builtin. You could have a sortediter as well

David



More information about the Python-list mailing list