Using super()
Michele Simionato
michele.simionato at gmail.com
Thu Jul 20 01:02:34 EDT 2006
Michele Simionato ha scritto:
> I believe the new style system was designed to allows this sort of
> mixing and
> that there are no issues at all.
Thinking a bit more, there are no issues at all if you know what a new
style class is and if you do not expect it to work as an old-style one
;) For the benefit of the OP, it may be useful to notice that there are
a few differences, most notably on how special methods works. Here is
an example:
class Old:
pass
old = Old()
old.__str__ = lambda : 'hello!'
print old # special methods defined on the instance are recognized
class New(Old, object):
pass
new = New()
new.__str__ = lambda : 'hello!' # special methods defined on the
instance are not recognized
print new
HTH,
Michele Simionato
More information about the Python-list
mailing list