Hi,
Just wonder if it's possible in Python.
what I want is to tweak an existing Python class A with no
constructor, so that A() results in fuctory method call?
so o = A() instead being equivalent to:
s = object()
A.__init__(s)
o = s
becomes:
o = my_factory_function( A )
Thanks,
Gennadiy
--
On Mon, May 11, 2009 at 1:39 PM, roge...@gmail.com wrote:
Hi,
Just wonder if it's possible in Python.
what I want is to tweak an existing Python class A with no
constructor, so that A() results in fuctory method call?
so o = A() instead being equivalent to:
s = object()
A.__init__(s)
On Monday 11 May 2009 04:39:41 pm roge...@gmail.com wrote:
so o = A() instead being equivalent to:
s = object()
A.__init__(s)
o = s
Actually, it would be more like this:
s = A.__new__(A)
if isinstance(s,A):
A.__init__(s)
o = s
o = my_factory_function( A )
You could tweak:
*) A's