A Python 3000 Question

Carl Banks pavlovevidence at gmail.com
Thu Nov 1 02:00:15 EDT 2007


On Oct 30, 1:30 am, George Sakkis <george.sak... at gmail.com> wrote:
>  Having a builtin len() that calls the method __len__
> seems (using your words) "not only foolish but wasteful".

But what about (for instance) having the bitwise not operator (^)
calling __bitwise_not__.  Is that foolish and wasteful?  Would a
hypothetical special syntax for len be foolish and wasteful.

All I'm trying to say here is that len is a built-in for a reason:
because Python considers len to be an operator.  It's not inconsistent
design.  It's not a defective spelling for a method.  len was
deliberately given a status greater than method calls.


Carl Banks




More information about the Python-list mailing list