singleton problems

Arnaud Delobelle arnodel at gmail.com
Sun Oct 3 07:11:25 EDT 2010


Arnaud Delobelle <arnodel at gmail.com> writes:
[...]
> That's because overriding __new__ doesn't prevent __init__ from being
> executed.  The reason for this is that when you do:
>
>     MySingle('jeff')
>
> what is executed is:
>
>     MySingle.__metaclass__.__call__('jeff')

Oops. I meant:

     MySingle.__metaclass__.__call__(MySingle, 'jeff')

-- 
Arnaud



More information about the Python-list mailing list