More __init__ methods
Arnaud Delobelle
arnodel at googlemail.com
Thu Nov 6 15:48:45 EST 2008
Ben Finney <bignose+hates-spam at benfinney.id.au> writes:
[...]
> All you need to know to understand the above is that it will have
> essentially the same result as:
>
> class A(object):
> # ...
>
> def _from_string(cls, s):
> # ...
> return cls(a, b, c)
> from_string = classmethod(_from_string)
> del _from_string
>
> without the intermediate binding of the ‘_from_string’ name.
So you mean it is the same as:
class A(object):
# ...
def from_string(cls, s):
# ...
from_string = classmethod(from_string)
:)
--
Arnaud
More information about the Python-list
mailing list