Class factory functions
Steven D'Aprano
steve at REMOVE.THIS.cybersource.com.au
Sun Mar 25 07:52:50 EDT 2007
On Sun, 25 Mar 2007 11:58:00 +0200, Peter Otten wrote:
>> But it doesn't work:
>>
>>>>> vint = verbosify_nclass(int)
>>>>> vint(42)
>> Calling constructor __new__ ...
>> Traceback (most recent call last):
>> File "<stdin>", line 1, in <module>
>> File "<stdin>", line 6, in __new__
>> TypeError: object.__new__(VClass) is not safe, use int.__new__()
>>
>>
>> What am I doing wrong?
>
> Why would you skip VClass in the super() calls?
That's a good question. If I every get a good answer, I'll let you know.
> This should work:
[snip]
As indeed it seems like it does.
Thank you,
--
Steven.
More information about the Python-list
mailing list