with as a reserved word

Fredrik Lundh fredrik at pythonware.com
Mon Jun 11 14:34:30 EDT 2007


BBands wrote:

> I gather that 'with' is on its way to becoming a reserved word. Is
> this something that will break?

yes.

> import Gnuplot
> gp = Gnuplot.Gnuplot(debug=1)
> data = Gnuplot.Data([1,2,3,4,3,2,3,4,3,2,1], with='linespoints')

if you have Python 2.5, you can try it out yourself:

 >>> dict(with=1)
<stdin>:1: Warning: 'with' will become a reserved keyword in Python 2.6
{'with': 1}

 >>> from __future__ import with_statement
 >>> dict(with=1)
   File "<stdin>", line 1
     dict(with=1)
             ^
SyntaxError: invalid syntax

</F>




More information about the Python-list mailing list