[Datetime-SIG] pytz vs. PEP 495 Was: PEP-431/495

Ethan Furman ethan at stoneleaf.us
Tue Aug 25 00:40:36 CEST 2015


On 08/24/2015 03:18 PM, Alexander Belopolsky wrote:
> On Mon, Aug 24, 2015 at 5:58 PM, Ethan Furman wrote:
>
>          try:
>               some_date = get_a_datetime_from_somewhere(ltdf=None)
>          except AmbiguousTimeError, NonExistentTimeError as e:
>               log(weird_time_error, e)
>               some_date = use_default(e.datetime)
>
>     ..
>> Writing functions to work around short-comings is not how I like to spend
>>  my time (see my contention above about library code).
>
>
> Neither do I.  That's why in my code you are more likely to see
>
> some_date = get_a_datetime_from_somewhere()
>
> instead of the wall of text that you presented.  As you can imagine, I will
>  not be happy facing a prospect of adding try:.. except's everywhere to port
>  my code to Python 3.6.

Why would you have to?  I am not suggesting that None be the default, simply that it be available.

--
~Ethan~


More information about the Datetime-SIG mailing list