If the string module is deprecated...

John J. Lee jjl at pobox.com
Sun Aug 29 14:26:29 CEST 2004


"Paul McGuire" <ptmcg at austin.rr._bogus_.com> writes:

> ... what will become of the module-level constants, such as uppercase,
> digits, hexdigits, etc.?  Will they become class-level constants of the str
> class?

I don't see why not.

One design decision I don't understand, though (which doesn't crop up
in the particular cases you list above):

staticmethods can be invoked through a class instance:

>>> class Foo:
...     @staticmethod
...     def bar():
...         print 'bar'
...
>>> f = Foo()
>>> f.bar()
bar
>>>

This is the issue that turned list.sorted() into builtin sorted() in
2.4 -- people would get confused expecting that [3,2,1].sorted() to
return [1,2,3], rather than raise TypeError.

Seems there is some disagreement amongst language desingers on whether
polymorphism is a good thing in static methods.


John



More information about the Python-list mailing list