strings and sort()
caljason76 at yahoo.com
Thu Feb 21 21:35:25 CET 2002
Paul Rubin <phr-n2002a at nightsong.com> wrote in message news:<7xg03vsidi.fsf at ruckus.brouhaha.com>...
> b = list(a)
> In Python, that's considered immoral--it puts you in danger of
> forgetting that the sort operation modifies the list that you use it
> on. For example, if you say
> a = b.sort()
> expecting to get a sorted copy of b without clobbering b, you'd get
> a rude surprise.
I still think that the convenience of having sort() return the list
far outweighs the cost. People would only get bit once, maybe twice,
before they learned the behavior of sort.
I like Python, but the biggest problem I have with the language right
now is what low code density it has at times.
More information about the Python-list