Beyond __str__ and __repr__? (Was Re: Python doesn't know how to do math?)

Erik Max Francis max at alcyone.com
Fri Apr 26 17:37:14 EDT 2002


Huaiyu Zhu wrote:

> It appears that another display level is needed, somewhat between repr
> and
> str.  Let's call it 'disp' here.  It is intended to be used for
> display in a
> controlled way, esp for nested structures.

Just derive a new class and override __str__ and/or __repr__ to do what
you want.

Adding _another_ stringifying builtin function doesn't seem anywhere
near worth it.

-- 
 Erik Max Francis / max at alcyone.com / http://www.alcyone.com/max/
 __ San Jose, CA, US / 37 20 N 121 53 W / ICQ16063900 / &tSftDotIotE
/  \ Life is one long process of getting tired.
\__/ Samuel Butler
    Interstelen / http://www.interstelen.com/
 A multiplayer, strategic, turn-based Web game on an interstellar scale.



More information about the Python-list mailing list