Hi Peter! >>>>> "PF" == Peter Funk <pf@artcom-gmbh.de> writes: PF> Since something like 'del for' or 'del import' raises a PF> SyntaxError exception in Py152, I expect 'del None' to raise PF> the same exception in Py3K, after None has become a keyword. PF> Right? I misread your example the first time through, but it still doesn't quite parse on my second read. -------------------- snip snip -------------------- pyvers = '2k' try: del import except SyntaxError: pyvers = '3k' -------------------- snip snip -------------------- % python /tmp/foo.py File "/tmp/foo.py", line 3 del import ^ SyntaxError: invalid syntax -------------------- snip snip -------------------- See, you can't catch that SyntaxError because it doesn't happen at run-time. Maybe you meant to wrap the try suite in an exec? Here's a code sample that ought to work with 1.5.2 and the mythical Py3K-with-a-None-keyword. -------------------- snip snip -------------------- pyvers = '2k' try: exec "del None" except SyntaxError: pyvers = '3k' except NameError: pass print pyvers -------------------- snip snip -------------------- Cheers, -Barry
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