[Python-Dev] copy, len and the like as 'object' methods?

Paul Prescod paulp@ActiveState.com
Wed, 22 Aug 2001 10:35:23 -0800


Guido van Rossum wrote:
> 
> > Again, I wasn't considering getting rid of old builtins.  We're going to
> > be adding new methods to all of the types anyway (since they'll derive
> > from object), so I was just suggesting that len or length be an alias
> > for __len__.
> 
> Hm, but this would violate TOOWTDI.

I am not an OO zealot but I am a consistency zealot. Calling a function
that just turns around and calls a method is somewhat confusing and
increasingly out of step with all of the other languages that support
OO.

I would appreciate if you could put this on the long-term fixes list and
then you could choose an appropriate time when the howls of pain would
be subdued. 

It really isn't in the same class as the division change because it is
easy to interpret old code in the old way. We could support the
"preferred syntax" and the "legacy syntax" indefinitely and there would
still only one RIGHT way to do it. (just like you could still throw
strings as exceptions but you aren't supposed to...)
-- 
Take a recipe. Leave a recipe.  
Python Cookbook!  http://www.ActiveState.com/pythoncookbook