Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Python > with as a reserved word

Reply
Thread Tools

with as a reserved word

 
 
BBands
Guest
Posts: n/a
 
      06-11-2007
I gather that 'with' is on its way to becoming a reserved word. Is
this something that will break?

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

>>> <module1>:3: Warning: 'with' will become a reserved keyword in Python 2.6


http://www.gnuplot.info/
http://gnuplot-py.sourceforge.net/

This was run by PyScripter 1.8.7.1 with Python 2.5.

jab

 
Reply With Quote
 
 
 
 
kyosohma@gmail.com
Guest
Posts: n/a
 
      06-11-2007
On Jun 11, 10:03 am, BBands <(E-Mail Removed)> wrote:
> I gather that 'with' is on its way to becoming a reserved word. Is
> this something that will break?
>
> import Gnuplot
> gp = Gnuplot.Gnuplot(debug=1)
> data = Gnuplot.Data([1,2,3,4,3,2,3,4,3,2,1], with='linespoints')
> gp.plot(data)
>
> >>> <module1>:3: Warning: 'with' will become a reserved keyword in Python 2.6

>
> http://www.gnuplot.info/http://gnupl...urceforge.net/
>
> This was run by PyScripter 1.8.7.1 with Python 2.5.
>
> jab


Looks that way since you can assign anything to 'for' or 'if' or other
reserved words.

Mike

 
Reply With Quote
 
 
 
 
Francesco Guerrieri
Guest
Posts: n/a
 
      06-11-2007
Within gnuplot you can shorten "with" to "w", don't know if it can
work inside a call to Gnuplot.Data()....

francesco

On 6/11/07, BBands <(E-Mail Removed)> wrote:
> I gather that 'with' is on its way to becoming a reserved word. Is
> this something that will break?
>
> import Gnuplot
> gp = Gnuplot.Gnuplot(debug=1)
> data = Gnuplot.Data([1,2,3,4,3,2,3,4,3,2,1], with='linespoints')
> gp.plot(data)
>
> >>> <module1>:3: Warning: 'with' will become a reserved keyword in Python 2.6

>
> http://www.gnuplot.info/
> http://gnuplot-py.sourceforge.net/
>
> This was run by PyScripter 1.8.7.1 with Python 2.5.
>
> jab
>
> --
> http://mail.python.org/mailman/listinfo/python-list
>



--
"Voilą! In view, a humble vaudevillian veteran, cast vicariously as
both victim and villain by the vicissitudes of fate. This visage, no
mere veneer of vanity, is a vestige of the vox populi, now vacant,
vanished. However, this valorous visitation of a bygone vexation
stands vivified, and has vowed to vanquish these venal and virulent
vermin vanguarding vice and vouchsafing the violently vicious and
voracious violation of volition. The only verdict is vengeance; a
vendetta held as a votive, not in vain, for the value and veracity of
such shall one day vindicate the vigilant and the virtuous. Verily,
this vichyssoise of verbiage veers most verbose vis-ą-vis an
introduction, so let me simply add that it's my very good honor to
meet you and you may call me V." -- V's introduction to Evey
 
Reply With Quote
 
Fredrik Lundh
Guest
Posts: n/a
 
      06-11-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>

 
Reply With Quote
 
BBands
Guest
Posts: n/a
 
      06-11-2007
On Jun 11, 11:34 am, Fredrik Lundh <(E-Mail Removed)> wrote:
> 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


I see that this change appears to be final.

http://www.python.org/dev/peps/pep-0343/

I don't have an opinion, pro or con, on this PEP, but I'll bet that it
breaks a lot of code.

jab

 
Reply With Quote
 
Fredrik Lundh
Guest
Posts: n/a
 
      06-11-2007
BBands wrote:

> I don't have an opinion, pro or con, on this PEP, but I'll bet that it
> breaks a lot of code.


that's why you get warnings in 2.5, so you have time to update your
code; see:

http://www.python.org/dev/peps/pep-0005/

estimating what "a lot" is isn't trivial, but it's worth noting that a
search for "langython \swith\W" over at google's code search only
brings up about 200 cases, and most of those are found in comments and
string literals. and in Zope.

</F>

 
Reply With Quote
 
BBands
Guest
Posts: n/a
 
      06-11-2007
On Jun 11, 12:47 pm, Fredrik Lundh <(E-Mail Removed)> wrote:
> estimating what "a lot" is isn't trivial, but it's worth noting that a
> search for "langython \swith\W" over at google's code search only
> brings up about 200 cases, and most of those are found in comments and
> string literals. and in Zope.


Well then, it would seem that the problems will be minimal. Good. I'll
have a look a the gnuplot.py code and post heads-up note to their
list.

Thanks,

jab

 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Is "www2" a sort of reserved word for path of web projects ? ("Publish website" failing without errors) craigkenisston@hotmail.com ASP .Net 1 01-19-2007 09:11 PM
Are Python's reserved words reserved in places they dont need to be? metaperl Python 32 09-15-2006 02:02 PM
RE: Are Python's reserved words reserved in places they dont needtobe? Delaney, Timothy (Tim) Python 10 09-14-2006 04:17 PM
Re: Are Python's reserved words reserved in places they dont needtobe? Steve Holden Python 0 09-13-2006 08:44 AM
[2.3] object does not appear to be a reserved word Daniel Klein Python 4 09-07-2003 01:49 AM



Advertisments