Why are timezone aware and naive datetimes not distinct classes?

Nobody nobody at nowhere.com
Fri Mar 8 22:33:40 CET 2013

On Fri, 08 Mar 2013 13:41:27 -0500, Roy Smith wrote:

> So, the question is, WHY aren't aware and naive datetimes separate 
> classes?  They share many attributes and methods, but not all.

They share all attributes and methods.

You could just as well ask why positive and negative floats aren't
separate classes (based upon the fact that e.g. math.sqrt() and math.log()
raise domain errors for negative floats).

Just because certain operations aren't defined for all values (or all
combinations of values), that doesn't make the values where those
operations aren't defined into a distinct type.

More information about the Python-list mailing list