[Python-Dev] Adding __format__ to classic classes

Guido van Rossum guido at python.org
Wed Feb 13 18:21:07 CET 2008


On Feb 13, 2008 5:28 AM, Eric Smith <eric+python-dev at trueblade.com> wrote:
> When backporting PEP 3101, do we want to add __format__ to classic
> classes?  If so, could someone give me a pointer on how to implement
> this?  I don't see where to hook it up.

You just have to get the '__format__' attribute and call it if it
exists. Isn't that how you do it for new-style classes too?

-- 
--Guido van Rossum (home page: http://www.python.org/~guido/)


More information about the Python-Dev mailing list