[Python-Dev] Draft PEP for time zone support.

Barry Warsaw barry at python.org
Thu Dec 20 17:43:15 CET 2012


On Dec 20, 2012, at 11:18 AM, Ben Finney wrote:

>Terry Reedy <tjreedy at udel.edu> writes:
>
>> On 12/12/2012 10:56 AM, Lennart Regebro wrote:
>>
>> >> It seems like calling get_timezone() with an unknown timezone
>> >> should just throw ValueError, not necessarily some custom
>> >> Exception?
>> >
>> > That could very well be. What are others opinions on this?
>>
>> ValueError. That is what it is. Nothing special here.
>
>I think it's useful to have this raise a custom exception
>UnknownTimeZoneError, subclassed from ValueError. That satisfies those
>(including me!) who think it should be a ValueError, while also making
>the exception more specific so it can be handled apart from other
>possible ValueError causes.
>
>In short: +1 to ‘class UnknownTimeZoneError(ValueError)’.

That would be `class UnknownTimeZoneError(ValueError, TimeZoneError)`.

-Barry
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 836 bytes
Desc: not available
URL: <http://mail.python.org/pipermail/python-dev/attachments/20121220/73c91265/attachment.pgp>


More information about the Python-Dev mailing list