Why this behavior? (was: Stupid Lambda Tricks)

Michael Hudson mwh at python.net
Thu Feb 21 07:12:50 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?

Well, strings are immutable, for one thing...

Cheers,
M.

-- 
  I've reinvented the idea of variables and types as in a
  programming language, something I do on every project.
                                          -- Greg Ward, September 1998



More information about the Python-list mailing list