Lawrence Oluyede wrote:
> Steven D'Aprano <[EMAIL PROTECTED]> wrote:
>> Is there any general mechanism? 
> 
> I'd just use the expected future feature and if the result is not what I
> expect (or Python raises any kind of exception, like using a keyword not
> present) I'd think I'm in the past :-)
> 
Of course if the use of the feature creates a syntax error in the 
__main__ module (as it might currently for a use of the "with" keyword 
in 2.5, for example) then there is no way to catch the exception and you 
are therefore SOL, no?

[EMAIL PROTECTED] ~/Projects/Python
$ cat test11.py
with open("myfile.txt") as f:
     print l for l in f


[EMAIL PROTECTED] ~/Projects/Python
$ python test11.py
test11.py:1: Warning: 'with' will become a reserved keyword in Python 2.6
   File "test11.py", line 1
     with open("myfile.txt") as f:
             ^
SyntaxError: invalid syntax


regards
  Steve
-- 
Steve Holden        +1 571 484 6266   +1 800 494 3119
Holden Web LLC/Ltd           http://www.holdenweb.com
Skype: holdenweb      http://del.icio.us/steve.holden
--------------- Asciimercial ------------------
Get on the web: Blog, lens and tag the Internet
Many services currently offer free registration
----------- Thank You for Reading -------------

-- 
http://mail.python.org/mailman/listinfo/python-list

Reply via email to