"Terry Reedy" <[EMAIL PROTECTED]> writes: > Consider > >>> map(len, ('abc', (1,2,3), [1,2], {1:2})) > [3, 3, 2, 1] > > Now try to rewrite this using methods (member functions).
[x.len() for x in ('abc', (1,2,3), [1,2], {1:2})] > > - Why doesn't sort() return a value? > > Because it is an in-place mutation method and Guido decided that such > methods should return None rather that the mutated object to lessen bugs. > It is a tradeoff that has been debated ever since ;-) Nah, we have sorted() now, a functionalista victory ;-) > I presume the new-in-2.5 default dicts will do the same, and also work when > the key does not exist and the default is a list. Man, it's hard to keep track of these new features. Default dicts do sound like a good addition; I've used those d.setdefault/d.get idioms way too often. -- http://mail.python.org/mailman/listinfo/python-list