Problem in a str subclass

Manus Hand manus at
Tue Nov 27 04:00:33 CET 2001

Can anyone explain why I get the following result?

Python 2.2b2 (#1, Nov 26 2001, 20:03:34)
[GCC egcs-2.91.66 19990314/Linux (egcs-1.1.2 release)] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> class X(str):
...     def __init__(self, xx = None):
...             if not xx: xx = 'ye olde default value'
...             str.__init__(self, xx)
>>> x = X('yo yo yo')
>>> x
'yo yo yo'
>>> x = X()
>>> x

I can't see why X() is not set to 'ye olde default value'


More information about the Python-list mailing list