Re: classmethod inheritance

2007-12-12 Thread Calvin Spealman
If you need multiple factories you can do so but to do what you're asking requires both a factory and an instance method initializer, just like __new__ is a class method and __init__ is an instance method. One creates and one initializes what is already created. On Dec 12, 2007, at 12:49 PM,

classmethod inheritance

2007-12-12 Thread Yoav Goldberg
A lot of my code supplement/replace the constructor with class factory methods. So, instead of: > a= A(...) I would write: > a = A.from_file(...) > a = A.create(...) etc. This is implemented as follows: class A: def __init__(self, ...): pass @classmethod def from_file(cls, ):