On Sun, Mar 15, 2009 at 10:50 AM, Michael Foord <fuzzy...@voidspace.org.uk> wrote: > Brett Cannon wrote: >> >> Without knowing what StatementSkipped is (just some singleton? If so why >> not just used SkipStatement instance that was raised?) and wondering if we >> are just going to continue to adding control flow exceptions that directly >> inherit from BaseException or some ControlFlowException base class, the >> basic idea seems fine by me. >> > > Note that using exceptions for control flow can be bad for other > implementations of Python. For example exceptions on the .NET framework are > very expensive. (Although there are workarounds such as not really raising > the exception - but they're ugly). > > Isn't it better practise for exceptions to be used for exceptional > circumstances rather than for control flow?
If my understanding is correct, the primary use case for this is when an exception is raised by an __enter__() method and caught by an enclosing __exit__() method. So at least in that case, you've already incurred the cost of an exception. It might be nice to see an example of this being used with only a single context manager. Is that possible? Steve -- I'm not *in*-sane. Indeed, I am so far *out* of sane that you appear a tiny blip on the distant coast of sanity. --- Bucky Katt, Get Fuzzy _______________________________________________ Python-Dev mailing list Python-Dev@python.org http://mail.python.org/mailman/listinfo/python-dev Unsubscribe: http://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com