With or without leading underscore...

Bruno Desthuilliers bruno.42.desthuilliers at websiteburo.invalid
Tue Aug 11 04:46:19 EDT 2009


Carl Banks a écrit :
(snip)


> class A(object):
>     def __init__(self,*args,**kwargs):
>         raise TypeError('Type not callable; use factory function
> instead')
> 
>     @classmethod
>     def _create_object(cls,initial_value):
>         self = object.__new__(cls) # avoid __init__
>         self.value = initial_value

I assume there's a missing "return self" line here ?-)



More information about the Python-list mailing list