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

Guido van Rossum guido@python.org
Wed, 22 Aug 2001 19:17:33 -0400


> > While it will admittedly take a while, the intention of string methods
> > was to eventually phase out the string module.  So TOOWTDI is only
> > violated during the transition.
> 
> Why wouldn't a similar strategy work for length and string attributes?

It hardly worked for string methods (see Aahz's response).

> >...
> > Personally, I don't think that the "problem" this change is addressing
> > is worth asking everybody to change their code -- so we'd have live
> > with len(x) and x.len() as viable ways to ask for x's length
> > *forever*, violating TOOWTDI permanently.  I don't like that.
> 
> How was the string methods problem more serious than this one?

It was motivated by the advent of Unicode, which required us to think
more OO.

AFAICT, the len() method proposal is just an attempt to be more OO,
and to avoid being made fun of by a bunch of Perlers.  I don't care
about #1, and it's naive to think that solving one issue will avoid
#2.

Any change like this has a *huge* cost to the community (just reread
the division thread).

> I'm not trying to be difficult: I really don't perceive a difference.

I do -- see above.

--Guido van Rossum (home page: http://www.python.org/~guido/)