Re-raising exceptions with modified message

Christoph Zwerschke cito at online.de
Sun Jul 15 04:52:54 EDT 2007


samwyse wrote:
 > NewStyle.__name__ = old.__class__.__name__

Simple, but that does the trick!

 > new.__dict__ = old.__dict__.copy()

Unfortunately, that does not work, since the attributes are not 
writeable and thus do not appear in __dict__.

But my __getattr__ solution does not work either, since the attributes 
are set to None when initialized, so __getattr__ is never called.

Need to think about this point some more...

Anyway, the beer is on me ;-)

-- Chris



More information about the Python-list mailing list