Why this behavior? (was: Stupid Lambda Tricks)

Paul Rubin phr-n2002a at nightsong.com
Thu Feb 21 07:50:23 EST 2002


Jonathan Gardner <jgardn at alumni.washington.edu> writes:
> I've always wondered:
> 
> >>> "abc".upper()
> "ABC"
> >>> [3,1,2].sort()
> < nothing >
> 
> Why is that? Is it just easier to implement it this way, or is there some 
> sound philosophical reason for this?

upper() doesn't alter its argument.  sort does.



More information about the Python-list mailing list