Boost logo

Boost :

From: David Abrahams (abrahams_at_[hidden])
Date: 2001-03-17 23:22:33


Lorien,

I think I may have hit on an ugly way to avoid the problem you're having:

MyPythonClass.__dict__["__init__"](self)

This appears to avoid turning the __init__ function into an unbound method.

>>> class X:
... def __init__(self):
... self.__doc__ = "hello world"
...
>>> def f(): print "hi"
...
>>> f.__doc__
>>> X.__init__
<unbound method X.__init__>
>>> X.__dict__["__init__"]
<function __init__ at 007DCDA4>
>>> X.__dict__["__init__"](f)
>>> f.__doc__
'hello world'

Regards,
Dave


Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk