Michael Chermside <mcherm@mcherm.com> writes: > Greg Ewing: >> Also while we're at it, how about storing the traceback in the >> exception object, and getting rid of sys.exc_info() etc.? > > Guido: >> That's a good idea, and I'd support a PEP on that topic more than PEP >> 317 (which IMO is unnecessary). > > IMO the biggest advantage of PEP 317 is not what it does directly but the > future enhancements it allows. If all exceptions really are objects, > (particularly if strengthened to say "instances of Exception or subclasses") > then we can add new features to Exception. Moving the traceback into > the object is one idea. Making Exception a new-style object is another > (no need to rush, but it'll happen SOMEDAY, right?). Exception > chaining (aka exception masking) is another. But PEP 317 seems to regard removing string exceptions entirely (something I support, possibly with a backward compatibility warning laden shim) as a minor stepping stone on the way to removing implicit instantiation (something I have a hard time caring about). And as a random data point, I cannot see me stopping typing e.g. raise TypeError, 'must set field "%s" to "%s", not "%s"'%(fname, reqt, gott) until Python shouts at me each and every time I do it. Some habits die hard[1]. > The point is, without PEP 317, you can't do these things, because sometimes > you use an object, and sometimes just mention a class (and sometimes just > use a string). PEP 317 choose not to try to bite off anything bigger than > fixing this so future enhancements would be possible. But we EVER want > these kinds of enhancements, then start a PEP 317 style migration NOW, > because degree of code breakage means that the migration time will be really > slow. Deprecating (ideally with warnings) sooner is better. I don't see how removing implicit instantiation makes this easier. Cheers, M. ... who would also like to see restartable exceptions, but isn't going to mention that today, oh no ... [1] I never got *into* the habit of using string exceptions, and in fact still don't quite understand what happens when you try and catch one (this is not an invitation for an explanation). -- ... but I guess there are some things that are so gross you just have to forget, or it'll destroy something within you. perl is the first such thing I have known. -- Erik Naggum, comp.lang.lisp
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4