__init__ function problem

Jia Lu Roka100 at gmail.com
Wed Nov 8 01:47:50 CET 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