On Sun, Jan 27, 2008, "Martin v. L?wis" wrote: > > Students just asked me why len() is not a method, and I didn't know a > good answer; the same holds for many other builtins. This is a clear > candidate for a method, IMO.
This is why len() is not a method: map(len, list_of_strings) What I don't know is to what extent this argument still holds in the presence of listcomps and genexps: [s.len() for s in list_of_strings] However, you still need ``len`` as a function to pass around as a callback in other cases where you need a generic function because the type of your data is not predetermined. In any event, I consider dropping len() from builtins to be gratuitous breakage, even in 3.0. -- Aahz ([EMAIL PROTECTED]) <*> http://www.pythoncraft.com/ "All problems in computer science can be solved by another level of indirection." --Butler Lampson _______________________________________________ Python-Dev mailing list Python-Dev@python.org http://mail.python.org/mailman/listinfo/python-dev Unsubscribe: http://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com