Why does Python mix OO concepts and non OO concepts for opera tion s on basic types?
jepler at unpythonic.net
Fri Jun 14 15:48:58 CEST 2002
On Fri, Jun 14, 2002 at 09:57:12AM +1000, Delaney, Timothy wrote:
> > From: holger krekel [mailto:pyth at devel.trillke.net]
> > probably. With python 1.6 many methods of the string *module* were
> > included included directly with the *type* string ('str'). Most
> > python developers think that the string module should be deprecated
> I think "most" is a little bit strong. The general feeling that I get seems
> to be pretty much split down the middle.
> I personally *don't* favour getting rid of the string module - there are
> many things which lend themselves better to a non-object-oriented style -
> and many of the string functions are included.
> Now, if the str type included *all* of this functionality, *and* was aliased
> to string, then you may have a case ... although 'import string' would still
> need to work (for backwards compatibility) until 3.0.
There are other problems with using "str" instead of "string", even when
the methods exist:
>>> u = U" hi there "
TypeError: descriptor 'rstrip' requires a 'str' object but received a 'unicode'
u' hi there'
More information about the Python-list