Re: [Python-3000] simplifying the exception mechanism

2007-01-23 Thread tomer filiba
well, if it helps improve speed, than that's fine. although i don't see how really. first of all, exceptions raised by python code must be normalized as the code might need the exception object, i.e. try: foo except bar: ex = sys.exc_info() so the only place it's meaningful is exceptions

Re: [Python-3000] Pre-peps on raise and except changes

2007-01-23 Thread Nick Coghlan
Phillip J. Eby wrote: > The 2-expression "raise" statement translation is incorrect in the general > case; it is possible for the second argument to be an instance of the first > argument, in which case 'raise E, V' should become just 'raise V'. This is > not detectable by the refactoring tool,

Re: [Python-3000] Exceptions internals and removing sys.exc_*

2007-01-23 Thread Thomas Wouters
On 1/22/07, Mark Hammond <[EMAIL PROTECTED]> wrote: > Guido has mentioned [1] that since exceptions will be growing a > __traceback__ attribute in Python 3, it should be possible to remove > sys.exc_info(). sys.exc_info() is also useful for returning the exception itself, not only the traceback

Re: [Python-3000] Pre-peps on raise and except changes

2007-01-23 Thread Brett Cannon
On 1/23/07, Nick Coghlan <[EMAIL PROTECTED]> wrote: > Phillip J. Eby wrote: > > The 2-expression "raise" statement translation is incorrect in the general > > case; it is possible for the second argument to be an instance of the first > > argument, in which case 'raise E, V' should become just 'rai

Re: [Python-3000] Exceptions internals and removing sys.exc_*

2007-01-23 Thread Brett Cannon
On 1/23/07, Thomas Wouters <[EMAIL PROTECTED]> wrote: > > > On 1/22/07, Mark Hammond <[EMAIL PROTECTED]> wrote: > > > Guido has mentioned [1] that since exceptions will be growing a > > > __traceback__ attribute in Python 3, it should be possible to remove > > > sys.exc_info(). > > > > sys.exc_info

Re: [Python-3000] Exceptions internals and removing sys.exc_*

2007-01-23 Thread Steven Bethard
On 1/23/07, Thomas Wouters <[EMAIL PROTECTED]> wrote: > > On 1/22/07, Mark Hammond <[EMAIL PROTECTED]> wrote: > > > Guido has mentioned [1] that since exceptions will be growing a > > > __traceback__ attribute in Python 3, it should be possible to remove > > > sys.exc_info(). > > > > sys.exc_info()

Re: [Python-3000] Exceptions internals and removing sys.exc_*

2007-01-23 Thread Fred L. Drake, Jr.
On Tuesday 23 January 2007 11:52, Steven Bethard wrote: > Sorry, for those of us following along at home ;-) could someone > explain why we couldn't just introduce a ``sys.get_exception()`` or > something like that which would then make the exception (and therefore > the traceback) available?

Re: [Python-3000] Exceptions internals and removing sys.exc_*

2007-01-23 Thread Thomas Wouters
On 1/23/07, Steven Bethard <[EMAIL PROTECTED]> wrote: On 1/23/07, Thomas Wouters <[EMAIL PROTECTED]> wrote: > > On 1/22/07, Mark Hammond <[EMAIL PROTECTED]> wrote: > > > Guido has mentioned [1] that since exceptions will be growing a > > > __traceback__ attribute in Python 3, it should be possib

Re: [Python-3000] Exceptions internals and removing sys.exc_*

2007-01-23 Thread Steven Bethard
On 1/23/07, Thomas Wouters <[EMAIL PROTECTED]> wrote: > On 1/23/07, Steven Bethard <[EMAIL PROTECTED]> wrote: > > Sorry, for those of us following along at home ;-) could someone > > explain why we couldn't just introduce a ``sys.get_exception()`` or > > something like that which would then make th

Re: [Python-3000] Exceptions internals and removing sys.exc_*

2007-01-23 Thread Collin Winter
On 1/23/07, Steven Bethard <[EMAIL PROTECTED]> wrote: > On 1/23/07, Thomas Wouters <[EMAIL PROTECTED]> wrote: > > On 1/23/07, Steven Bethard <[EMAIL PROTECTED]> wrote: > > > Sorry, for those of us following along at home ;-) could someone > > > explain why we couldn't just introduce a ``sys.get_exc

Re: [Python-3000] Pre-peps on raise and except changes

2007-01-23 Thread Collin Winter
On 1/23/07, Nick Coghlan <[EMAIL PROTECTED]> wrote: > Phillip J. Eby wrote: > > The 2-expression "raise" statement translation is incorrect in the general > > case; it is possible for the second argument to be an instance of the first > > argument, in which case 'raise E, V' should become just 'rai

Re: [Python-3000] Pre-peps on raise and except changes

2007-01-23 Thread Brett Cannon
On 1/23/07, Collin Winter <[EMAIL PROTECTED]> wrote: > On 1/23/07, Nick Coghlan <[EMAIL PROTECTED]> wrote: > > Phillip J. Eby wrote: > > > The 2-expression "raise" statement translation is incorrect in the general > > > case; it is possible for the second argument to be an instance of the > > > fi

Re: [Python-3000] Pre-peps on raise and except changes

2007-01-23 Thread Collin Winter
On 1/23/07, Brett Cannon <[EMAIL PROTECTED]> wrote: > On 1/23/07, Collin Winter <[EMAIL PROTECTED]> wrote: > >This form has two sub-variants: ``E`` may be either an > >instance of ``BaseException`` [#pep352]_ or a subclass of > >``BaseException``. If ``E`` is a subclass, it will be called w

Re: [Python-3000] Pre-peps on raise and except changes

2007-01-23 Thread Jim Jewett
On 1/23/07, Collin Winter <[EMAIL PROTECTED]> wrote: > Does this language work for you? > """ > 2. ``raise E`` (with a single argument) is used to raise a new >exception. This form has two sub-variants: ``E`` may be either an >instance of ``BaseException`` [#pep352]_ or a subclass of >

Re: [Python-3000] Pre-peps on raise and except changes (was: Warning for 2.6 and greater)

2007-01-23 Thread Collin Winter
On 1/22/07, Phillip J. Eby <[EMAIL PROTECTED]> wrote: The correct translation of a try/except should be: try: ... except E as N: try: ... finally: N = None del N i.e., you left out the crucial try/finally wrapper. If y

Re: [Python-3000] Pre-peps on raise and except changes

2007-01-23 Thread Brett Cannon
On 1/23/07, Collin Winter <[EMAIL PROTECTED]> wrote: > On 1/23/07, Brett Cannon <[EMAIL PROTECTED]> wrote: > > On 1/23/07, Collin Winter <[EMAIL PROTECTED]> wrote: > > >This form has two sub-variants: ``E`` may be either an > > >instance of ``BaseException`` [#pep352]_ or a subclass of > > >

Re: [Python-3000] Pre-peps on raise and except changes (was: Warning for 2.6 and greater)

2007-01-23 Thread Giovanni Bajo
On 22/01/2007 23.45, Collin Winter wrote: > target, thus eliminating the reference cycle. The source-to-source > translation, as suggested by Phillip J. Eby [#except-translation]_ is > :: > > try: > ... > except E as N: > ... > ... > > is translated to :: > >