Neil Cerutti <[EMAIL PROTECTED]> wrote: > On 2007-10-31, Duncan Booth <[EMAIL PROTECTED]> wrote: >> Obviously it isn't an absolute thing: lists and dictionaries do >> have other methods in the user namespace, so the decision to >> keep len out of that namespace is partly a judgement call, and >> partly historical (I think tuples didn't used to have any >> methods at all). > > Thanks for the interesting note. I didn't know that tuples > originally had no methods. That made len mandatory, I suppose. > Only if you think tuples are a sequence rather than a record. :)
Come to think of it, strings didn't have methods either, so len needed to be a function to get the length of a string. I'm not sure when tuples sprouted methods. Strings grew methods in 1.6, but I think numbers and tuples may not have got any methods until the introduction of new-style classes (Python 2.2) -- http://mail.python.org/mailman/listinfo/python-list