__init__ function problem

Jia Lu Roka100 at gmail.com
Tue Nov 7 19:47:50 EST 2006


> In Python, the real constructor is called __new__, >
> Carl Banks

But the code below won't invoke __new__:

[CODE]
class Test:
    def __new__(self, value):
        print "__new__",value
    def __init__(self,value):
        print "__init__",value

x = Test("testing")
[/CODE]




More information about the Python-list mailing list