strings and sort()
Paul Rubin
phr-n2002a at nightsong.com
Thu Feb 21 16:36:04 EST 2002
caljason76 at yahoo.com (Jason) writes:
> > 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 tend to agree with you on this, though I'd have preferred that sort
return the list but be called nsort instead of sort, like in Common Lisp.
> I like Python, but the biggest problem I have with the language right
> now is what low code density it has at times.
Agreed on that too.
More information about the Python-list
mailing list