Eric Smith wrote: > The problem is that if an object does does its own > __format__, it either needs to understand all of the string formatting, > or at least recognize a string format and send it along to > string.__format__() (or object.__format__, which will convert to string > for you).
No, all it needs to do is tell when it *doesn't* recognise the format and call its inherited __format__ method. Eventually that will get to object.__format__ which will delegate to str. > Note the collision with the 's' format_spec in this example. I'd say you should normally design your format specs so that they don't conflict with string formats. If you want to implement the string formats your own way, that's okay, but then it's your responsibility to support all of them. -- Greg _______________________________________________ Python-3000 mailing list Python-3000@python.org http://mail.python.org/mailman/listinfo/python-3000 Unsubscribe: http://mail.python.org/mailman/options/python-3000/archive%40mail-archive.com