Mark Dickinson <[email protected]> added the comment:
I had understood that the rule was that alternate constructors should be
classmethods, for consistency with __new__. (Well, except that __new__ is
actually a staticmethod, of course... )
E.g., after "class MyDecimal(Decimal): pass", MyDecimal('2.3') produces a
MyDecimal instance, and by analogy MyDecimal.from_float(2.3) should also
produce a MyDecimal instance. It's exactly the same type of function as the
class constructor.
I don't think it would do any harm to get clarification from python-dev on the
underlying reasons.
----------
_______________________________________
Python tracker <[email protected]>
<http://bugs.python.org/issue2267>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe:
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com