[IPython-user] More ipython and python2.5: 'with' statements
Zachary Pincus
zpincus at stanford.edu
Thu Mar 9 19:16:57 CST 2006
Hi folks,
In python 2.6, 'with' and 'as' will become keywords (see http://
www.python.org/doc/peps/pep-0343/ ). Python 2.5 gives a warning about
these symbols if used, and 'with blocks' can be used with a 'from
__future__ import with_statement' line.
However, ipython seems to somehow cause 'with' and 'as' to be treated
as reserved keywords even if no 'from __future__' line is executed.
(See below for example.)
I'm not sure how this is happening. Any thoughts?
Zach
zpincus% python
Python 2.5a0 (trunk:42924M, Mar 8 2006, 19:29:24)
[GCC 4.0.1 (Apple Computer, Inc. build 5250)] on darwin
>>> with = 5
<stdin>:1: Warning: 'with' will become a reserved keyword in Python 2.6
>>> from __future__ import with_statement
>>> with = 5
File "<stdin>", line 1
with = 5
^
SyntaxError: invalid syntax
zpincus% ipython
In [1]: with = 5
------------------------------------------------------------
File "<ipython console>", line 1
with = 5
^
<class 'exceptions.SyntaxError'>: invalid syntax
More information about the IPython-user
mailing list