Am 31.01.2012 00:50, schrieb Matt Joiner: > Sounds good, but I also prefer Alexander's method. The type information is > already encoded in the class object. 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.
Sorry, I don't think it makes any sense to pass around classes as flags. Sure, if you do something directly with the class, it's fine, but in this case that's impossible. So you will be testing if format is datetime.datetime: ... elif format is decimal.Decimal: ... else: ... which has no advantage at all over if format == "datetime": ... elif format == "decimal": ... else: Not to speak of formats like "timespec" that don't have a respective class. And how do you propose to handle the extensibility you speak of to work? 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