Am 31.01.2012 13:08, schrieb Victor Stinner: >> This way you don't need to maintain a >> mapping of strings to classes, and other functions/third party can join in >> the fun without needing access to the latest canonical mapping. Lastly there >> will be no confusion or contention for duplicate keys. > > My patch checks isinstance(format, type), format.__module__ and > format.__name__ to do the "mapping". It is not a direct mapping > because I don't always call the same method, the implementation is > completly differenet for each type. > > I don't think that we need user defined timestamp formats. My last > patch provides 5 formats: > > - int > - float > - decimal.Decimal > - datetime.datetime > - datetime.timedelta > > (I removed the timespec format, I consider that we don't need it.)
Rather, I guess you removed it because it didn't fit the "types as flags" pattern. As I said in another message, another hint that this is the wrong API design: Will the APIs ever support passing in types other than these five? Probably not, so I strongly believe they should not be passed in as types. Georg _______________________________________________ Python-Dev mailing list Python-Dev@python.org http://mail.python.org/mailman/listinfo/python-dev Unsubscribe: http://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com