explicit call to __init__(self) in subclass needed?
Andrew MacKeith
andrew at mackeith.net
Thu Sep 17 13:22:48 EDT 2009
I create a class like this in Python-2.6
>>> class Y(str):
... def __init__(self, s):
... pass
...
>>> y = Y('giraffe')
>>> y
'giraffe'
>>>
How does the base class (str) get initialized with the value passed to Y.__init__() ?
Is this behavior specific to the str type, or do base classes not need to be explicitly initialized?
Andrew
More information about the Python-list
mailing list