473,385 Members | 1,449 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,385 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 1890

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: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...

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.