<div dir="ltr">+1 on a classmethod constructor<div>+0 on a based-on-type default constructor</div><div><br></div><div>+inf on SOMETHING!</div><div><br></div><div>Let's get passed the bike shedding and make this work!</div><div><br></div><div>-CHB</div><div><br></div></div><div class="gmail_extra"><br><div class="gmail_quote">On Wed, Oct 25, 2017 at 2:18 PM, Alex Walters <span dir="ltr"><<a href="mailto:tritium-list@sdamon.com" target="_blank">tritium-list@sdamon.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><span class=""><br>
<br>
> -----Original Message-----<br>
> From: Alexander Belopolsky [mailto:<a href="mailto:alexander.belopolsky@gmail.com">alexander.belopolsky@<wbr>gmail.com</a>]<br>
</span><span class="">> Sent: Wednesday, October 25, 2017 4:33 PM<br>
> To: Alex Walters <<a href="mailto:tritium-list@sdamon.com">tritium-list@sdamon.com</a>><br>
</span><span class="">> Cc: Elvis Pranskevichus <<a href="mailto:elprans@gmail.com">elprans@gmail.com</a>>; Python-Dev <python-<br>
> <a href="mailto:dev@python.org">dev@python.org</a>>; Chris Barker <<a href="mailto:chris.barker@noaa.gov">chris.barker@noaa.gov</a>><br>
> Subject: Re: [Python-Dev] iso8601 parsing<br>
><br>
</span><div><div class="h5">> On Wed, Oct 25, 2017 at 3:48 PM, Alex Walters <<a href="mailto:tritium-list@sdamon.com">tritium-list@sdamon.com</a>><br>
> wrote:<br>
> > Why make parsing ISO time special?<br>
><br>
> It's not the ISO format per se that is special, but parsing of str(x).<br>
> For all numeric types, int, float, complex and even<br>
> fractions.Fraction, we have a roundtrip invariant T(str(x)) == x.<br>
> Datetime types are a special kind of numbers, but they don't follow<br>
> this established pattern. This is annoying when you deal with time<br>
> series where it is common to have text files with a mix of dates,<br>
> timestamps and numbers. You can write generic code to deal with ints<br>
> and floats, but have to special-case anything time related.<br>
<br>
</div></div>>>> repr(datetime.datetime.now())<br>
'datetime.datetime(2017, 10, 25, 17, 16, 20, 973107)'<br>
<br>
You can already roundtrip the repr of datetime objects with eval (if you care to do so). You get iso formatting from a method on dt objects, I don’t see why it should be parsed by anything but a classmethod.<br>
<br>
<br>
</blockquote></div><br><br clear="all"><div><br></div>-- <br><div class="gmail_signature" data-smartmail="gmail_signature"><br>Christopher Barker, Ph.D.<br>Oceanographer<br><br>Emergency Response Division<br>NOAA/NOS/OR&R (206) 526-6959 voice<br>7600 Sand Point Way NE (206) 526-6329 fax<br>Seattle, WA 98115 (206) 526-6317 main reception<br><br><a href="mailto:Chris.Barker@noaa.gov" target="_blank">Chris.Barker@noaa.gov</a></div>
</div>