Re: [Python-Dev] iso8601 parsing

2017年10月25日 22:40:41 -0700

On 26 October 2017 at 07:30, Chris Barker <[email protected]> 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".
Cheers,
Nick.
-- 
Nick Coghlan | [email protected] | Brisbane, Australia
_______________________________________________
Python-Dev mailing list
[email protected]
https://mail.python.org/mailman/listinfo/python-dev
Unsubscribe: 
https://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com

Reply via email to