473,287 Members | 1,899 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,287 software developers and data experts.

RE: question about python statements

Hi
Thanks a lot for your reply
I think the main uses for it is to study the language and to see that I
didn't miss anything else or that something is changed from one version
to another.

The keyword module will help me

Thanks again
Ohad Frand
-----Original Message-----
From: Gary Herron [mailto:gh*****@islandtraining.com]
Sent: Tuesday, May 13, 2008 11:11 AM
To: Ohad Frand
Cc: py*********@python.org
Subject: Re: question about python statements

Ohad Frand wrote:
Hi Gary

Sorry that I was not clear, I hope that this time I will explain
myself
better.

I can get list of all builtin functions in python by
dir(__builtins__).
This return a list of string with most known names to python language
such as:
[... 'issubclass', 'iter', 'len', 'license', 'list', 'locals', 'long',
'map', 'max', 'min', 'object', 'oct', 'open', 'ord', 'pow',
'property',
'quit', 'range', 'raw_input', 'reduce', 'reload'...]

But I don't know how to generate the next list of builtin python
statements:
['assert','break','class','continue','def','del','e lif','else','except',
'exec','finally','for','from','global',
'if','import','pass','print','raise','return','try ','while','yield']
There is no way you can consider 'elif', 'else', 'except', and 'from'
statements. However, as someone pointed out, the kwlist from the
keyword module is the closest thing we can think of to the list you are
asking for.

On the other hand, what's wrong with constructing the list as you did in

your example above?
Just out of curiosity, *why* do you want this list. Perhaps is we knew

that, we could think of a programmatic way to construct the list you
want. The biggest challenge at the moment is that we have no idea what

you mean by statement, but it is certainly not what Python considers
statements.

Gary Herron
Thanks,
Ohad Frand

-----Original Message-----
From: Gary Herron [mailto:gh*****@islandtraining.com]
Sent: Monday, May 12, 2008 10:41 PM
To: Ohad Frand
Cc: py*********@python.org
Subject: Re: question about python statements

Ohad Frand wrote:
>Hi

I am looking for a way to programmically get a list of all python
existing statements that I cannot access by __builtins__ or locals()

(like ["assert","break","class",...])

Thanks,

Ohad
------------------------------------------------------------------------
>--
http://mail.python.org/mailman/listinfo/python-list
Sorry, I've no idea what you mean here. Perhaps you could help us by
defining what you mean by
"statements that I cannot access by __builtins__ or locals()"

Is there any statement that you *can* access in such a way?

What does it even mean to "access a statement"?

Do you even have a list of "statements" from which we are to work?
Python is a little unusual in what it considers statements.

Gary Herron

Jun 27 '08 #1
0 1424

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

220
by: Brandon J. Van Every | last post by:
What's better about Ruby than Python? I'm sure there's something. What is it? This is not a troll. I'm language shopping and I want people's answers. I don't know beans about Ruby or have...
54
by: Brandon J. Van Every | last post by:
I'm realizing I didn't frame my question well. What's ***TOTALLY COMPELLING*** about Ruby over Python? What makes you jump up in your chair and scream "Wow! Ruby has *that*? That is SO...
3
by: Brian L. | last post by:
After following the discussion on Generator expressions on python-dev for the last few weeks, and finally getting used to list comprehensions as opposed to map/filter, it occurred to me that the...
45
by: Edward K. Ream | last post by:
Hello all, First of all, my present state of mind re pep 318 is one of sheepish confusion. I suspect pep 318 will not affect Leo significantly, but I am most surprised that an apparently...
65
by: Steven Watanabe | last post by:
I know that the standard idioms for clearing a list are: (1) mylist = (2) del mylist I guess I'm not in the "slicing frame of mind", as someone put it, but can someone explain what the...
17
by: Eric_Dexter | last post by:
def simplecsdtoorc(filename): file = open(filename,"r") alllines = file.read_until("</CsInstruments>") pattern1 = re.compile("</") orcfilename = filename + "orc" for line in alllines: if not...
90
by: John Salerno | last post by:
I'm a little confused. Why doesn't s evaluate to True in the first part, but it does in the second? Is the first statement something different? False print 'hi' hi Thanks.
0
by: Ohad Frand | last post by:
Hi Gary Sorry that I was not clear, I hope that this time I will explain myself better. I can get list of all builtin functions in python by dir(__builtins__). This return a list of string...
0
by: Gary Herron | last post by:
Ohad Frand wrote: There is no way you can consider 'elif', 'else', 'except', and 'from' statements. However, as someone pointed out, the kwlist from the keyword module is the closest thing we...
2
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 7 Feb 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:30 (7.30PM). In this month's session, the creator of the excellent VBE...
0
by: MeoLessi9 | last post by:
I have VirtualBox installed on Windows 11 and now I would like to install Kali on a virtual machine. However, on the official website, I see two options: "Installer images" and "Virtual machines"....
0
by: DolphinDB | last post by:
The formulas of 101 quantitative trading alphas used by WorldQuant were presented in the paper 101 Formulaic Alphas. However, some formulas are complex, leading to challenges in calculation. Take...
0
by: Aftab Ahmad | last post by:
So, I have written a code for a cmd called "Send WhatsApp Message" to open and send WhatsApp messaage. The code is given below. Dim IE As Object Set IE =...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: marcoviolo | last post by:
Dear all, I would like to implement on my worksheet an vlookup dynamic , that consider a change of pivot excel via win32com, from an external excel (without open it) and save the new file into a...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.