Message108061
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. |
|
| Date |
User |
Action |
Args |
| 2010-06-17 20:52:19 | mark.dickinson | set | recipients:
+ mark.dickinson, brett.cannon, amaury.forgeotdarc, belopolsky, stingray |
| 2010-06-17 20:52:19 | mark.dickinson | set | messageid: <[email protected]> |
| 2010-06-17 20:52:17 | mark.dickinson | link | issue2267 messages |
| 2010-06-17 20:52:16 | mark.dickinson | create | |
|