Antoine Pitrou <[EMAIL PROTECTED]> added the comment: Le dimanche 22 juin 2008 à 20:40 +0000, Adam Olsen a écrit : > > How do you duplicate an instance of an user-defined exception? Using > an > > equivalent of copy.deepcopy()? It will probably end up much more > > expensive than the above-mentioned O(n) search. > > Passing in e.args is probably sufficient.
I think it's very optimistic :-) Some exception objects can hold dynamic state which is simply not stored in the "args" tuple. See Twisted's Failure objects for an extreme example: http://twistedmatrix.com/trac/browser/trunk/twisted/python/failure.py (yes, it is used an an exception: see "raise self" in the trap() method) > Can be, or will be? Only the most common behaviour needs to be optimized. Well, the "most common behaviour" is a very short context chain, which is already optimized by my reference-avoidance proposal... _______________________________________ Python tracker <[EMAIL PROTECTED]> <http://bugs.python.org/issue3112> _______________________________________ _______________________________________________ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com