[Python-Dev] iso8601 parsing
Nick Coghlan
ncoghlan at gmail.com
Thu Oct 26 01:37:48 EDT 2017
More information about the Python-Dev mailing list
Thu Oct 26 01:37:48 EDT 2017
- Previous message (by thread): [Python-Dev] iso8601 parsing
- Next message (by thread): [Python-Dev] iso8601 parsing
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
On 26 October 2017 at 07:30, Chris Barker <chris.barker at noaa.gov> 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 | ncoghlan at gmail.com | Brisbane, Australia -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://mail.python.org/pipermail/python-dev/attachments/20171026/c5155177/attachment.html>
- Previous message (by thread): [Python-Dev] iso8601 parsing
- Next message (by thread): [Python-Dev] iso8601 parsing
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
More information about the Python-Dev mailing list