473,320 Members | 1,832 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,320 software developers and data experts.

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 1887

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: Gary Herron | last post by:
Ohad Frand wrote: 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...
0
by: Ohad Frand | last post by:
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...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
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: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
0
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...

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.