Stepping backwards in for loop?

Marcin 'Qrczak' Kowalczyk qrczak at knm.org.pl
Sat Apr 14 18:37:15 EDT 2001


Sat, 14 Apr 2001 13:37:54 -0300, Carlos Ribeiro <cribeiro at mail.inet.com.br> pisze:

> It would be a *lot* easier if strings had a reverse method, or if the 
> reverse() methods returned the reversed string. However, similarly to 
> sort(), the Python-way-of-doing-things must have some good reason for 
> reverse() to behave this way (as a inplace operation on the list).

I don't think there is a deep reason, except some efficiency.
The functional style would provide these operations as returning
new versions.

They could be added to Python under names reversed() and sorted()
to avoid confusion.

-- 
 __("<  Marcin Kowalczyk * qrczak at knm.org.pl http://qrczak.ids.net.pl/
 \__/
  ^^                      SYGNATURA ZASTĘPCZA
QRCZAK



More information about the Python-list mailing list