very good reasons?

Dan Schmidt dfan at harmonixmusic.com
Fri Sep 29 15:01:44 EDT 2000


Grant Griffin <g2 at seebelow.org> writes:

| I would have expected sort and reverse to return the list in
| question, but instead they return None.

sort and reverse return None so you don't get fooled into thinking
that they don't modify the list you passed in as an argument.

If you could write

  sorted_arr = arr.sort()

then people might get surprised that arr changed.

-- 
                 Dan Schmidt | http://www.dfan.org
Honest Bob CD now available! | http://www.dfan.org/honestbob/cd.html



More information about the Python-list mailing list