> This got me thinking when we were discussing it in the issue. It's > plausible that every subclass of builtin types will need to implement > __format__ to act sanely. So maybe we can propose some sort of API (on the > Python level) that makes parsing the format string easy and will not make > code go stale? What do you think? > > > I've proposed this in the past, primarily for Decimal. I'd be okay with > it. It would need to done carefully to allow us to expand the format > string, for example when we added ','. Maybe return a namedtuple or > equivalent. > > But remember, not all types understand the same format strings. datetime > being the classic case. > > Sure, this is why I specifically restricted it to subclasses of builtin types, because these should presumably understand the flags used for builtin types. Anyway, we'll see how much parsing will have to be done in practice for IntEnum - it can serve as a guinea pig.
Eli
_______________________________________________ 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