[Fredrik Lundh] > the last revision of the "time type" proposal seems to suggest that all > time types should implement the following interface: Calling T datetime.time, and D datetime.datetime: > tm = timeobject.timetuple() D yes, T no. > cmp(timeobject, timeobject) Both yes, but not a mix of D and T. > hash(timeobject) Both yes. It's curious that that the minimal API doesn't have a way to create a timeobject ab initio (the only operations here with a timeobject output need a timeobject as input first). > and optionally > > deltaobject = timeobject - timeobject D yes, T no. > floatobject = float(deltaobject) # fractional seconds datetime.timedelta doesn't have anything like that, but it could be useful. Converting a timedelta to minutes (or seconds, or whatever) is painful now. I'd rather see explicit .toseconds(), .tominutes() (etc) methods. A caution that an IEEE double doesn't necessariy have enough bits of precision so that roundrip equality can be guaranteed. I expect you'd also need an API to create a delta object from a number of seconds (in datetime that's spelled datetime.timedelta(seconds=a_float_int_or_long) ). > timeobject = timeobject + integerobject Neither, and unclear what it means (is the integer seconds? milliseconds? days? etc). > timeobject = timeobject + floatobject Neither, likewise. > timeobject = timeobject + deltaobject D yes, T no.
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