On Thu, Sep 4, 2008 at 12:36 PM, Guido van Rossum <[EMAIL PROTECTED]> wrote:
> On Wed, Sep 3, 2008 at 9:25 PM, Raymond Hettinger <[EMAIL PROTECTED]> wrote:
>> [Brett]
>>> I gave a talk last night at the Vancouver Python users group on
>>> 2.6/3.0, and I tried the following code and it failed during a live demo:
>>>
>>>  >>> try: pass
>>>  ... except Exception, Exception: pass
>>>   File "<stdin>", line 2
>>>     except Exception, Exception: pass
>>>                                ^
>>>  SyntaxError: invalid syntax
>>>
>>> Now from what I can tell from PEP 3110, that should be legal in 3.0.
>>> Am I reading the PEP correctly?
>>
>> Don't think so.
>> The parens are necessary for a tuple of exceptions
>> lest it be confused with the old "except E, v" syntax
>> which meant "except E as e".
>>
>> Maybe in 3.1, the paren requirement can be dropped.
>
> I would wait longer -- until well after the 2.x line is dead and
> buried. It will take some time for every Python user to train their
> Python fingers not to type "except E, v:" and we don't want people who
> are late in migrating inserting bugs like this in their first 3.x program.


it's probably a good idea to leave the paren requirement in there, but
i just reread the PEP myself, and it appears as though no parens is
actually supported, specifically: "except AttributeError, os.error:"
here:

http://www.python.org/dev/peps/pep-3110/#grammar-changes

also, and granted this is older info, Guido's 2006 talks seem to hint
this as well:

- change except clause syntax to except E1, E2, E3 as err:
    - this avoids the bug in except E1, E2: # meant except (E1, E2)

from both of these:

ACCU - Apr 2006 (slide 11)
http://www.python.org/doc/essays/ppt/accu2006/Py3kACCU.ppt

Vancouver Python Workshop - Aug 2006 (slide 13)
http://www.vanpyz.org/conference/2006/proceedings/MarygX/Py3KVanPyz.ppt

while we can't change the past, we can/should at least update the PEP
as well as the current 2.6 and 3.0 docs to specifically state that the
parens are required (for now) *and* give an example usage.

cheers,
-- wesley

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
"Python Web Development with Django", Addison Wesley, (c) 2008
http://withdjango.com

wesley.j.chun :: wescpy-at-gmail.com
python training and technical consulting
cyberweb.consulting : silicon valley, ca
http://cyberwebconsulting.com
_______________________________________________
Python-3000 mailing list
Python-3000@python.org
http://mail.python.org/mailman/listinfo/python-3000
Unsubscribe: 
http://mail.python.org/mailman/options/python-3000/archive%40mail-archive.com

Reply via email to