[Datetime-SIG] Making dt parameter of timezone.tzname(dt) optional

Guido van Rossum guido at python.org
Wed Sep 9 18:19:09 CEST 2015


+1, just submit a patch and mark it for 3.6.

On Wed, Sep 9, 2015 at 8:49 AM, Berker Peksağ <berker.peksag at gmail.com>
wrote:

> The idea was came up when I reviewed issue 22241 [1] and Alexander
> said "This is a reasonable request":
>
>     http://bugs.python.org/review/22241/
>
> Currently, we have tests like (see Lib/test/datetimetester.py)
>
>     self.assertEqual('UTC', timezone.utc.tzname(None))
>     self.assertEqual('UTC', timezone(ZERO).tzname(None))
>     self.assertEqual('UTC-05:00', timezone(-5 * HOUR).tzname(None))
>     self.assertEqual('UTC+09:30', timezone(9.5 * HOUR).tzname(None))
>
> Can we just make dt optional and set its default value to None in Python
> 3.6? So
>
>    timezone.utc.tzname(None) and timezone.utc.tzname()
>
> will both return "UTC". It's a small change, but I think it will make
> the API cleaner.
>
> --Berker
>
> [1] http://bugs.python.org/issue22241
> _______________________________________________
> Datetime-SIG mailing list
> Datetime-SIG at python.org
> https://mail.python.org/mailman/listinfo/datetime-sig
> The PSF Code of Conduct applies to this mailing list:
> https://www.python.org/psf/codeofconduct/
>



-- 
--Guido van Rossum (python.org/~guido)
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/datetime-sig/attachments/20150909/a5b735e3/attachment.html>


More information about the Datetime-SIG mailing list