Re: Retrieving Python Keywords

2011-04-11 Thread Glazner
On Apr 10, 4:28 am, candide wrote: > Python is very good at introspection, so I was wondering if Python (2.7) > provides any feature to retrieve the list of its keywords (and, as, > assert, break, ...). >>> import keyword >>> keyword.kwlist ['and', 'as', 'assert', 'break', 'class', 'continue', 'd

Re: Retrieving Python Keywords

2011-04-10 Thread Terry Reedy
On 4/10/2011 5:12 AM, candide wrote: Le 10/04/2011 04:01, Terry Reedy a écrit : Yes. (Look in the manuals, I did : my main reference book is the Martelli's /Python in a Nutshell/ You should only use that as a supplement. and the index doesn't refer to the keyword import and now you kno

Re: Retrieving Python Keywords

2011-04-10 Thread candide
Le 10/04/2011 04:01, Terry Reedy a écrit : Yes. (Look in the manuals, I did : my main reference book is the Martelli's /Python in a Nutshell/ and the index doesn't refer to the keyword import or try the obvious imports ;-) The only obvious I saw was sys module. -- http://mail.python

Re: Retrieving Python Keywords

2011-04-10 Thread candide
Le 10/04/2011 04:09, John Connor a écrit : Actually this is all it takes: import keywords print keywords.kwlist >>> import keywords Traceback (most recent call last): File "", line 1, in ImportError: No module named keywords >>> so I considered first it was a joke ! ;) In fact the import

Re: Retrieving Python Keywords

2011-04-09 Thread Steven D'Aprano
On Sun, 10 Apr 2011 03:28:10 +0200, candide wrote: > Python is very good at introspection, so I was wondering if Python (2.7) > provides any feature to retrieve the list of its keywords (and, as, > assert, break, ...). import keyword -- Steven -- http://mail.python.org/mailman/listinfo/python

Re: Retrieving Python Keywords

2011-04-09 Thread John Connor
Actually this is all it takes: import keywords print keywords.kwlist --jac On Sat, Apr 9, 2011 at 8:57 PM, Chris Angelico wrote: > On Sun, Apr 10, 2011 at 11:28 AM, candide wrote: >> Python is very good at introspection, so I was wondering if Python (2.7) >> provides any feature to retrieve the

Re: Retrieving Python Keywords

2011-04-09 Thread Terry Reedy
On 4/9/2011 9:28 PM, candide wrote: Python is very good at introspection, so I was wondering if Python (2.7) provides any feature to retrieve the list of its keywords (and, as, assert, break, ...). Yes. (Look in the manuals, or try the obvious imports ;-) -- Terry Jan Reedy -- http://mail.pyt

Re: Retrieving Python Keywords

2011-04-09 Thread Chris Angelico
On Sun, Apr 10, 2011 at 11:28 AM, candide wrote: > Python is very good at introspection, so I was wondering if Python (2.7) > provides any feature to retrieve the list of its keywords (and, as, assert, > break, ...). I don't know about any other way, but here's a really REALLY stupid method. For

Retrieving Python Keywords

2011-04-09 Thread candide
Python is very good at introspection, so I was wondering if Python (2.7) provides any feature to retrieve the list of its keywords (and, as, assert, break, ...). -- http://mail.python.org/mailman/listinfo/python-list

RE: Changing the names of python keywords

2007-06-23 Thread vedrandekovic
Hello, I on working on windows and Python 2.4. Where can I find and CHANGE python grammar. ( I just want to change the keywords ) PLEASE HELP ME SOMEBODY!! THANKS! -- http://mail.python.org/mailman/listinfo/python-lis

RE: Changing the names of python keywords

2007-06-23 Thread ...:::JA:::...
Hello, I on working on windows and Python 2.4. Where can I find and CHANGE python grammar. ( I just want to change the keywords ) PLEASE HELP ME SOMEBODY!! THANKS! __

Re: Changing the names of python keywords

2007-06-22 Thread Ognjen Bezanov
[EMAIL PROTECTED] escribió: > Hello again, > > Thanks for everything previously, I was change the grammar and Lib/ > keyword.py, now > Python recognize "koristiti" as a keyword, but that is not enough: > > when I write in my python shell: > koristiti os # "koristiti" get

Re: Changing the names of python keywords and functions

2007-06-22 Thread Stargaming
[EMAIL PROTECTED] schrieb: > Hello, > > I am trying to make a program for 3D modelling with "programming".And > I want make my own program commands, > > for example when user type code in my program: > > "<> OS"- (THIS IS MY IMAGINARY EXAMPLE OF KEYWORD), > > my program must write this code in

RE: Changing the names of python keywords

2007-06-22 Thread vedrandekovic
Hello again, Thanks for everything previously, I was change the grammar and Lib/ keyword.py, now Python recognize "koristiti" as a keyword, but that is not enough: when I write in my python shell: >>> koristiti os # "koristiti" get keyword "color", but I get >>> error: File

Re: Changing the names of python keywords and functions

2007-06-21 Thread Martin v. Löwis
he import of any Python module written for the standard keywords -- > such as many of those in the standard library? Most certainly, yes. > My understanding of the original poster's requirement was that the > keywords should be additional to, not replacement for, the existing >

Re: Changing the names of python keywords and functions

2007-06-21 Thread Ben Finney
ged in the Python executable, won't that break the import of any Python module written for the standard keywords -- such as many of those in the standard library? My understanding of the original poster's requirement was that the keywords should be additional to, not replacement for, the

Re: Changing the names of python keywords and functions

2007-06-21 Thread Martin v. Löwis
> "<> OS"- (THIS IS MY IMAGINARY EXAMPLE OF KEYWORD), > > my program must write this code in some user file, but my > > program must read this command like: "import os".How > > can I do something like that?? The keywords are listed in Grammar/Grammar. You need to edit this file, then recompile

Re: Changing the names of python keywords and functions

2007-06-21 Thread vedrandekovic
[EMAIL PROTECTED] je napisao/la: > I'm not quite clear on what you are asking, but > you can use the __import__() function to import modules by name. > I want to invent something like my "programming language" like Python with the same keywords just changed, for example if user type in my "progr

Re: Changing the names of python keywords and functions

2007-06-21 Thread moegoldberg
I'm not quite clear on what you are asking, but you can use the __import__() function to import modules by name. On Jun 21, 3:07 pm, [EMAIL PROTECTED] wrote: > Hello, > > I am trying to make a program for 3D modelling with "programming".And > I want make my own program commands, > > for example wh

Changing the names of python keywords and functions

2007-06-21 Thread vedrandekovic
Hello, I am trying to make a program for 3D modelling with "programming".And I want make my own program commands, for example when user type code in my program: "<> OS"- (THIS IS MY IMAGINARY EXAMPLE OF KEYWORD), my program must write this code in some user file, but my program must read this

Re: Python keywords

2007-04-26 Thread Alex Martelli
gtb <[EMAIL PROTECTED]> wrote: > Have done some searching but have not found a place where I can look > up python keywords. >>> import keyword >>> keyword.kwlist ['and', 'as', 'assert', 'break', 'class', &#x

Re: Python keywords

2007-04-26 Thread gtb
On Apr 26, 1:59 pm, "Hamilton, William " <[EMAIL PROTECTED]> wrote: > > -Original Message- > > From: [EMAIL PROTECTED] > [mailto:python- > > [EMAIL PROTECTED] On Behalf Of gtb > > Sent: Thursday, April 26, 2007 1:50 PM > > To: [EMAIL PROTECT

Re: Python keywords

2007-04-26 Thread gtb
Thanks Marc. -- http://mail.python.org/mailman/listinfo/python-list

RE: Python keywords

2007-04-26 Thread Hamilton, William
> -Original Message- > From: [EMAIL PROTECTED] [mailto:python- > [EMAIL PROTECTED] On Behalf Of gtb > Sent: Thursday, April 26, 2007 1:50 PM > To: python-list@python.org > Subject: Re: Python keywords > > On Apr 26, 10:16 am, Larry Bates <[EMAIL

Re: Python keywords

2007-04-26 Thread gtb
On Apr 26, 10:16 am, Larry Bates <[EMAIL PROTECTED]> wrote: > gtb wrote: > > Have done some searching but have not found a place where I can look > > up python keywords. I was looking at a script that contained the > > following line: > > > assert self.getRespo

Re: Python keywords

2007-04-26 Thread Marc 'BlackJack' Rintsch
In <[EMAIL PROTECTED]>, gtb wrote: > Have done some searching but have not found a place where I can look > up python keywords. I was looking at a script that contained the > following line: > > assert self.getResponseCode() in (200, 304, 302) > > I can infer the usag

Re: Python keywords

2007-04-26 Thread Larry Bates
gtb wrote: > Have done some searching but have not found a place where I can look > up python keywords. I was looking at a script that contained the > following line: > > assert self.getResponseCode() in (200, 304, 302) > > I can infer the usage here but previously I had

Python keywords

2007-04-26 Thread gtb
Have done some searching but have not found a place where I can look up python keywords. I was looking at a script that contained the following line: assert self.getResponseCode() in (200, 304, 302) I can infer the usage here but previously I had thought that "in" was only used with

Re: Python keywords vs. English grammar

2006-05-24 Thread Roy Smith
In article <[EMAIL PROTECTED]>, Boris Borcic <[EMAIL PROTECTED]> wrote: > Roy Smith wrote: > > and all three keywords are verbs, so when you describe the code, you can > > use the same English words as in the program source, "You try to execute > > some code, but it throws a foo, which is caug

Re: Python keywords vs. English grammar

2006-05-24 Thread Boris Borcic
Roy Smith wrote: > I noticed something interesting today. In C++, you write: > > try { >throw foo; > } catch { > } > > and all three keywords are verbs, so when you describe the code, you can > use the same English words as in the program source, "You try to execute > some code, but it thr

Re: Python keywords vs. English grammar

2006-05-24 Thread bruno at modulix
defcon8 wrote: > 1. Does it matter? > 2. Is it affecting your productivity. > 3. Are you not trying to programme? > 4. It is open source, change it and stop whining. > What about trying emacs +x doctor ? -- bruno desthuilliers python -c "print '@'.join(['.'.join([w[::-1] for w in p.split('.')]

Re: Python keywords vs. English grammar

2006-05-24 Thread defcon8
1. Does it matter? 2. Is it affecting your productivity. 3. Are you not trying to programme? 4. It is open source, change it and stop whining. -- http://mail.python.org/mailman/listinfo/python-list

Re: Python keywords vs. English grammar

2006-05-24 Thread John Salerno
Roy Smith wrote: > try { >throw foo; > } catch { > } > try: >raise foo > except: But which one is prettier? ;) -- http://mail.python.org/mailman/listinfo/python-list

Re: Python keywords vs. English grammar

2006-05-24 Thread Duncan Smith
Roy Smith wrote: > I noticed something interesting today. In C++, you write: > > try { >throw foo; > } catch { > } > > and all three keywords are verbs, so when you describe the code, you can > use the same English words as in the program source, "You try to execute > some code, but it thr

Re: Python keywords vs. English grammar

2006-05-24 Thread Rony Steelandt
I'm not a english speaker, so I just accepted it...; I understood it as : 'Try' allways to execute this code, 'except' when it doesn't work do this > I noticed something interesting today. In C++, you write: > > try { >throw foo; > } catch { > } > > and all three keywords are verbs, so

Python keywords vs. English grammar

2006-05-24 Thread Roy Smith
I noticed something interesting today. In C++, you write: try { throw foo; } catch { } and all three keywords are verbs, so when you describe the code, you can use the same English words as in the program source, "You try to execute some code, but it throws a foo, which is caught by the han