• Tim Peters's avatar
    date and datetime comparison: when we don't know how to · 8d81a012
    Tim Peters yazdı
    compare against "the other" argument, we raise TypeError,
    in order to prevent comparison from falling back to the
    default (and worse than useless, in this case) comparison
    by object address.
    
    That's fine so far as it goes, but leaves no way for
    another date/datetime object to make itself comparable
    to our objects.  For example, it leaves Marc-Andre no way
    to teach mxDateTime dates how to compare against Python
    dates.
    
    Discussion on Python-Dev raised a number of impractical
    ideas, and the simple one implemented here:  when we don't
    know how to compare against "the other" argument, we raise
    TypeError *unless* the other object has a timetuple attr.
    In that case, we return NotImplemented instead, and Python
    will give the other object a shot at handling the
    comparison then.
    
    Note that comparisons of time and timedelta objects still
    suffer the original problem, though.
    8d81a012
Adı
Son kayıt (commit)
Son güncelleme
Demo Loading commit data...
Doc Loading commit data...
Grammar Loading commit data...
Include Loading commit data...
Lib Loading commit data...
Mac Loading commit data...
Misc Loading commit data...
Modules Loading commit data...
Objects Loading commit data...
PC Loading commit data...
PCbuild Loading commit data...
Parser Loading commit data...
Python Loading commit data...
RISCOS Loading commit data...
Tools Loading commit data...
.cvsignore Loading commit data...
.hgtags Loading commit data...
LICENSE Loading commit data...
Makefile.pre.in Loading commit data...
README Loading commit data...
configure Loading commit data...
configure.in Loading commit data...
install-sh Loading commit data...
pyconfig.h.in Loading commit data...
setup.py Loading commit data...