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

Berker Peksağ berker.peksag at gmail.com
Wed Sep 9 17:49:52 CEST 2015

The idea was came up when I reviewed issue 22241 [1] and Alexander
said "This is a reasonable request":


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.


[1] http://bugs.python.org/issue22241

More information about the Datetime-SIG mailing list