Eric Snow added the comment: I'm doing some string-based serialization of datetimes and need to be able to specify the type somewhat declaratively. So I'm using a datetime subclass. This is more or less the code I'm using:
class Timestamp(datetime.datetime): def __new__(cls, raw_value, *args, **kwargs): if not args and not kwargs: return cls.fromtimestamp(int(raw_value)) else: return super(Timestamp, cls).__new__(cls, raw_value, *args, **kwargs) def __str__(self): return str(int(time.mktime(self.timetuple()))) Incidently, the whole equality testing thing didn't actually cause a problem. It was comparing against the result of `datetime.utcnow()` which has microseconds (and my Timestamp instance didn't). Clearing out the microseconds resolved the failure so I wasn't actually bitten by this issue after all. ---------- _______________________________________ Python tracker <rep...@bugs.python.org> <http://bugs.python.org/issue5516> _______________________________________ _______________________________________________ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com