Dmitry wrote: > I'm new to Python but quite familiar with Lisp. So my question is > about Python list-related functions. Why append(), extend(), sort(), > reverse() etc. doesn't return a reference to it's own (modified) > argument ? doesn't Lisp have a FAQ? ;-) http://www.python.org/doc/FAQ.html#6.20 Q. Why doesn't list.sort() return the sorted list? ... basically, operations that modify an object generally don't return the object itself, to avoid mistakes like: for item in list.reverse(): print item # backwards ... for item in list.reverse(): print item # backwards, or? a slightly more pythonic way would be to add sorted, extended, reversed (etc) -- but that leads to method bloat. in addition, based on studying huge amounts of python code, I doubt cascading list operations would save the world that much typing... followups to python-list@python.org </F>
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4