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. > But for 3.0, it would be a problem given that old > scripts would start getting misinterpreted. > > I did something similar for list.sort() by requiring > keyword arguments. That way, we wouldn't have > list.sort(f) running with f as a cmp function 2.6 and > as a key function in 3.0. > > > Raymond > > > _______________________________________________ > 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/guido%40python.org > -- --Guido van Rossum (home page: http://www.python.org/~guido/) _______________________________________________ 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