Re: [Python-Dev] iso8601 parsing

2017-10-25 Thread Nick Coghlan
On 26 October 2017 at 07:30, Chris Barker 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 classmetho

Re: [Python-Dev] iso8601 parsing

2017-10-25 Thread Fred Drake
On Wed, Oct 25, 2017 at 10:37 PM, Wes Turner wrote: > What would you call the str argument? Does it accept strptime args or only > ISO8601? There'd be no reason to accept a format. That wouldn't make sense. A .fromiso(s:str) should only accept an ISO 8601 string, though I'd advocate tolerating

Re: [Python-Dev] iso8601 parsing

2017-10-25 Thread Wes Turner
On Wednesday, October 25, 2017, Chris Barker wrote: > On Wed, Oct 25, 2017 at 4:22 PM, Alexander Belopolsky < > alexander.belopol...@gmail.com > > wrote: > >> > times. The only difference is that instead of calling the type directly, >> > you call the appropriate classmethod. >> > >> > What am I

Re: [Python-Dev] iso8601 parsing

2017-10-25 Thread Guido van Rossum
I think this ship has long sailed. Sorry Alexander, but I see a new class method in your future. -- --Guido van Rossum (python.org/~guido) ___ Python-Dev mailing list Python-Dev@python.org https://mail.python.org/mailman/listinfo/python-dev Unsubscribe:

Re: [Python-Dev] iso8601 parsing

2017-10-25 Thread Chris Barker
On Wed, Oct 25, 2017 at 4:22 PM, Alexander Belopolsky < alexander.belopol...@gmail.com> wrote: > > times. The only difference is that instead of calling the type directly, > > you call the appropriate classmethod. > > > > What am I missing? > > Nothing. The only annoyance is that the data processi

Re: [Python-Dev] iso8601 parsing

2017-10-25 Thread Alexander Belopolsky
On Wed, Oct 25, 2017 at 5:30 PM, Chris Barker wrote: > Let's get passed the bike shedding and make this work! Sure. Submitting a pull request for would be a good start. ___ Python-Dev mailing list Python-Dev@python

Re: [Python-Dev] iso8601 parsing

2017-10-25 Thread Alexander Belopolsky
On Wed, Oct 25, 2017 at 5:30 PM, Steven D'Aprano wrote: > Maybe I'm just being slow today, but I don't see how you can write > "generic code" to convert text to int/float/complex/Fraction, but not > times. The only difference is that instead of calling the type directly, > you call the appropriate

Re: [Python-Dev] iso8601 parsing

2017-10-25 Thread Steven D'Aprano
On Wed, Oct 25, 2017 at 04:32:39PM -0400, Alexander Belopolsky wrote: > On Wed, Oct 25, 2017 at 3:48 PM, Alex Walters wrote: > > Why make parsing ISO time special? > > It's not the ISO format per se that is special, but parsing of str(x). > For all numeric types, int, float, complex and even > f

Re: [Python-Dev] iso8601 parsing

2017-10-25 Thread Chris Barker
+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! -CHB On Wed, Oct 25, 2017 at 2:18 PM, Alex Walters wrote: > > > > -Original Message- > > From: Alexander Belopolsky [mailto:alexander.be

Re: [Python-Dev] iso8601 parsing

2017-10-25 Thread Random832
On Wed, Oct 25, 2017, at 16:32, Alexander Belopolsky wrote: > This is annoying when you deal with time > series where it is common to have text files with a mix of dates, > timestamps and numbers. You can write generic code to deal with ints > and floats, but have to special-case anything time rel

Re: [Python-Dev] iso8601 parsing

2017-10-25 Thread Alex Walters
> -Original Message- > From: Alexander Belopolsky [mailto:alexander.belopol...@gmail.com] > Sent: Wednesday, October 25, 2017 4:33 PM > To: Alex Walters > Cc: Elvis Pranskevichus ; Python-Dev d...@python.org>; Chris Barker > Subject: Re: [Python-Dev] iso8601 parsing > > On Wed, Oct 25

Re: [Python-Dev] iso8601 parsing

2017-10-25 Thread Alexander Belopolsky
On Wed, Oct 25, 2017 at 3:48 PM, Alex Walters wrote: > Why make parsing ISO time special? It's not the ISO format per se that is special, but parsing of str(x). For all numeric types, int, float, complex and even fractions.Fraction, we have a roundtrip invariant T(str(x)) == x. Datetime types ar

Re: [Python-Dev] iso8601 parsing

2017-10-25 Thread Alex Walters
> -Original Message- > From: Python-Dev [mailto:python-dev-bounces+tritium- > list=sdamon@python.org] On Behalf Of Elvis Pranskevichus > Sent: Tuesday, October 24, 2017 8:12 PM > To: python-dev@python.org > Cc: Chris Barker > Subject: Re: [Python-Dev] iso8601 parsing > > On Tuesday,

Re: [Python-Dev] iso8601 parsing

2017-10-25 Thread Alex Walters
> -Original Message- > From: Alexander Belopolsky [mailto:alexander.belopol...@gmail.com] > Sent: Wednesday, October 25, 2017 12:07 PM > To: Alex Walters > Cc: Chris Barker ; Python-Dev d...@python.org> > Subject: Re: [Python-Dev] iso8601 parsing > > > > > On Oct 25, 2017, at 11:45 A

Re: [Python-Dev] iso8601 parsing

2017-10-25 Thread Alexander Belopolsky
> On Oct 25, 2017, at 11:45 AM, Alex Walters wrote: > > it means > the type of the first argument changes the semantic meaning of subsequent > arguments, and that just adds a level of confusion to any api. No, it does not. Passing a string a the first of three arguments will still be a type e

Re: [Python-Dev] iso8601 parsing

2017-10-25 Thread Alex Walters
> -Original Message- > From: Python-Dev [mailto:python-dev-bounces+tritium- > list=sdamon@python.org] On Behalf Of Alexander Belopolsky > Sent: Tuesday, October 24, 2017 5:54 PM > To: Chris Barker > Cc: Python-Dev > Subject: Re: [Python-Dev] iso8601 parsing > > On Tue, Oct 24, 2017