[Python-Dev] Issue 2736: datetimes and Unix timestamps (original) (raw)
Alexandre Zani alexandre.zani at gmail.com
Tue Jun 5 20:37:42 CEST 2012
- Previous message: [Python-Dev] Issue 2736: datetimes and Unix timestamps
- Next message: [Python-Dev] Issue 2736: datetimes and Unix timestamps
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
On Tue, Jun 5, 2012 at 11:26 AM, Antoine Pitrou <solipsis at pitrou.net> wrote:
Le 05/06/2012 19:21, Alexander Belopolsky a écrit :
with timezone.utc added to datetime module already the cost of supplying tzinfo to UTC datetime objects is low. 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.
Regards Antoine.
Python-Dev mailing list Python-Dev at python.org http://mail.python.org/mailman/listinfo/python-dev Unsubscribe: http://mail.python.org/mailman/options/python-dev/alexandre.zani%40gmail.com
- Previous message: [Python-Dev] Issue 2736: datetimes and Unix timestamps
- Next message: [Python-Dev] Issue 2736: datetimes and Unix timestamps
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]