More __init__ methods

Mr.SpOOn mr.spoon21 at gmail.com
Fri Nov 7 13:58:20 CET 2008


On Thu, Nov 6, 2008 at 11:00 PM, Ben Finney
<bignose+hates-spam at benfinney.id.au> wrote:
> Yes, the main reason is that it kills duck typing. The initialiser
> should *use* the parameters passed, and allow exceptions to propagate
> back to the caller if the parameters don't behave as expected.
>
> Another good reason to avoid the above style is that it's far too
> complex. Different behaviours should be in different functions.

Sorry for double posting, but in this way it seems I can't use
instance method inside the classmethod. Probably it is the right
behavior, but if I use this @classmethod style to simplify the
__init__ method, now I should move code from instance method inside
the classmethods.

In this way I'm kinda mixing things. I mean, if to construct an object
I have to use different methods, what can I do? Or am I missing
something, as usual?



More information about the Python-list mailing list