On Mon, Aug 24, 2015 at 3:05 PM, Ethan Furman <[email protected]> wrote:

> I would be much happier about this if:
>
>  >>> datetime(2004, 4, 4, 2, first=None,
> tzinfo=Eastern2).astimezone().isoformat()
>  Traceback (most recent call last):
>    File "<stdin>", line 1, in <module>
>    File ".../pytz/tzinfo.py", line 327, in localize
>      raise NonExistentTimeError(dt)
>  NonExistentTimeError: 2004-04-04 02:00:00
>
> Giving the programmer an easier option to use if they want an exception.
>

Which of the steps you want to raise an exception:

>>> dt = datetime(2004, 4, 4, 2, first=None, tzinfo=Eastern2)
>>> ldt = dt.astimezone()

or

>>> ldt.isoformat()

and why?

The stack trace that you presented comes for "localize", but no such method
is proposed in PEP 495.
_______________________________________________
Datetime-SIG mailing list
[email protected]
https://mail.python.org/mailman/listinfo/datetime-sig
The PSF Code of Conduct applies to this mailing list: 
https://www.python.org/psf/codeofconduct/

Reply via email to