Overwriting 'self' in constructor?
Costas Malamas
cmalamas at nyx10.nyx.net
Tue Oct 10 11:31:37 EDT 2000
I apologize if this is a newbie question, but I RTFM'ed to no avail:
I am trying to extend a class that produces an object in two steps: the
constructor produces a factory object and then there is a method that
returns the object I really want, i.e.: A.make(). Now, I want to extend
A, but I'd like to get the second type of object from the constructor.
Python (1.52, 1.6, Win32) won't let me do this:
class B(A):
def __init__(self):
A.__init__(self)
self = A.make(self)
The product of this is _always_ 'self' as defined by A.__init__() Why?
Can I/Should I work around it?
Thanks in advance,
Costas
--
costas malamas _______________________________________________________
http://www.nyx.net/~cmalamas/
*** Remove 'blackhole.' from the e-mail address to reply ***
-------- engineers never lie; we just approximate the truth. ---------
More information about the Python-list
mailing list