The Very High Layer and friends

Dan Schmidt dfan at harmonixmusic.com
Wed May 5 11:06:45 EDT 1999


"Thomas S. Strinnhed" <thstr at serop.abb.se> writes:

| Now I have some question about the Python/C API.
| In the Python/C API Reference Manual chapter 2 mentions The Very High
| Layer, very brief. 
| Does anyone know where to get more information about the methods in this
| chapter?? 

Unfortunately, the documentation is not very good here.  The book
Programming Python has a lot of information, although it refers to 1.3
so sometimes it is slightly out of date (I was tripped up for a minute
because the constant eval_input had changed).

| I'm very keen on finding out about the PyRun_AnyFile(),
| PyRun_SimpleFile() and PyRun_File(), how they work and differ.

PyRun_SimpleFile() simply runs a file.

>From looking at pythonrun.c, it appears that PyRun_AnyFile() just runs
PyRun_SimpleFile() if it's a file, and PyRun_InteractiveLoop() if the
file is really interactive, like stdin.

PyRun_File() runs a file, but you hand it
 - Py_single_input, Py_file_input, or Py_eval_input, to tell it what
   kind of data you're handing it.  According to the Grammar file:

   # single_input is a single interactive statement;
   # file_input is a module or sequence of commands read from an input file;
   # eval_input is the input for the eval() and input() functions.

 - the dictionaries it should use for the local and global namespaces.

It also has a PyObject* return value, unlike the other two, so you can
actually get results back from your Python script.

| Of course I want to know more about the other methods as well.
| 
| I know this is not the "source.wanted" but maybe someone has pointers to
| some (simple) examples of Python embedded i C? 

See the Demo/embed directory in the Python source distribution.

| (In case you haven't noticed I'm new to Python, but eager to learn and
| start working with it. I'm most grateful for all the help and support I
| can get. By the way, are there any prepared presentations of Python,
| like slides, pros/cons-lists etc, to help in introducing it to collegues
| and employers??)

http://www.python.org/doc/Intros.html is a good place to start.

-- 
                 Dan Schmidt -> dfan at harmonixmusic.com, dfan at alum.mit.edu
Honest Bob & the                http://www2.thecia.net/users/dfan/
Factory-to-Dealer Incentives -> http://www2.thecia.net/users/dfan/hbob/
          Gamelan Galak Tika -> http://web.mit.edu/galak-tika/www/




More information about the Python-list mailing list