Steven D'Aprano <[EMAIL PROTECTED]> writes: > >> Now try to rewrite this using methods (member functions). > > [a.len() for a in ('abc', (1,2,3), [1,2], {1:2})] > > Did you actually try that?
No of course not. It's in a hypothetical python where .len() is a class operation instead of a global function. > In any case, list comprehensions are a recent (version 2.2 I think?) > addition to Python. You have to think about the functionality > available back in the days when the decision to make len() a function was > made, not based on what functionality is available a decade later. Correct, so the answer to the OP's question might well be "it's that way because of historical accidents". -- http://mail.python.org/mailman/listinfo/python-list