A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://mail.python.org/pipermail/python-dev/2012-June/119931.html below:

[Python-Dev] Issue 2736: datetimes and Unix timestamps

[Python-Dev] Issue 2736: datetimes and Unix timestamps [Python-Dev] Issue 2736: datetimes and Unix timestampsAntoine Pitrou solipsis at pitrou.net
Tue Jun 5 21:01:44 CEST 2012
Le 05/06/2012 20:37, Alexandre Zani a écrit :
>>
>> This is nice when your datetime objects are freshly created. It is not so
>> nice when some of them already exist e.g. in a database (using an ORM
>> layer). Mixing naive and aware datetimes is currently a catastrophe, since
>> even basic operations such as equality comparison fail with a TypeError (it
>> must be pretty much the only type in the stdlib with such poisonous
>> behaviour).
>
> Comparing aware and naive datetime objects doesn't make much sense but
> it's an easy mistake to make. I would say the TypeError is a sensible
> way to warn you while simply returning False could lead to much
> confusion.

You could say the same about equally "confusing" results, yet equality 
never raises TypeError (except between datetime instances):

 >>> () == []
False

Raising an exception has very serious implications, such as making it 
impossible to put these objects in the same dictionary.

Regards

Antoine.

More information about the Python-Dev mailing list

RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4