On 26 October 2017 at 07:30, Chris Barker firstname.lastname@example.org wrote:
+1 on a classmethod constructor +0 on a based-on-type default constructor
+inf on SOMETHING!
Let's get passed the bike shedding and make this work!
I'll also note that these aren't either/or outcomes: adding a str-specific classmethod *doesn't* preclude implicitly calling that class method from the default constructor later based on the input type.
For example, decimal.Decimal.from_float() was added before the type constructor gained native support for float inputs, due to concerns about potential binary-vs-decimal rounding errors arising from doing such conversions implicitly.
So we can add "datetime.fromisoformat(isotime: str)" now, and then *if* we later decide to support the "type(x)(str(x)) == x" numeric invariant for the datetime classes, that can be specified as "If the constructor arguments consist of a single string, that is handled by calling the fromisoformat class method".