How does python work

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Geiregat Jonas

    How does python work

    I'm asking myself how Python code get's executed ...
    What happens first etc ...
    First read the file and then ..
    How python handle's variable internally ...
    also could someone point me to the build in functions in the python source
    code ?
  • A.M. Kuchling

    #2
    Re: How does python work

    On Thu, 10 Jul 2003 13:05:07 +0200,
    Geiregat Jonas <[email protected]> wrote:[color=blue]
    > I'm asking myself how Python code get's executed ...
    > What happens first etc ...
    > First read the file and then ..[/color]

    The code is parsed and compiled into bytecode that can then be executed.
    Consult a textbook on parsing or programming language implementation for
    more details about how parsing is done.

    I thought someone (MWH?) wrote an explanation of Python's internals once,
    but can't find anything at the moment. The Python docs have some relevant
    material (http://www.python.org/doc/current/ext/ext.html), but that document
    doesn't concentrate on the implementation details, just on the bits you can
    easily access from extensions.
    [color=blue]
    > also could someone point me to the build in functions in the python source
    > code ?[/color]

    They're in Python/bltinmodule.c.

    --amk
    OTHELLO: Once more, well met at Cyprus!
    -- _Othello_, II, i

    Comment

    • Peter Scott

      #3
      Re: How does python work

      "Geiregat Jonas" <[email protected]> wrote in message news:<pan.2003. 07.10.11.05.07. [email protected]>...[color=blue]
      > I'm asking myself how Python code get's executed ...
      > What happens first etc ...
      > First read the file and then ..
      > How python handle's variable internally ...
      > also could someone point me to the build in functions in the python source
      > code ?[/color]

      The Python Library Reference has a section on "Built-in Functions,
      Types, and Exceptions" at
      <http://www.python.org/doc/current/lib/builtin.html>. There is also a
      section documenting some rather low level internal modules at
      <http://www.python.org/doc/current/lib/language.html>, such as parser,
      which lets you access the parse tree, and dis, a disassembler for
      python bytecode.

      -Peter

      Comment

      • Michael Hudson

        #4
        Re: How does python work

        "A.M. Kuchling" <[email protected]> writes:
        [color=blue]
        > On Thu, 10 Jul 2003 13:05:07 +0200,
        > Geiregat Jonas <[email protected]> wrote:[color=green]
        > > I'm asking myself how Python code get's executed ...
        > > What happens first etc ...
        > > First read the file and then ..[/color]
        >
        > The code is parsed and compiled into bytecode that can then be executed.
        > Consult a textbook on parsing or programming language implementation for
        > more details about how parsing is done.
        >
        > I thought someone (MWH?) wrote an explanation of Python's internals once,
        > but can't find anything at the moment.[/color]

        I've threatened to do it, but not actually done it.

        If you can read C, these things aren't that hard to figure out (though
        tags or cscope certainly help...).

        Cheers,
        M.

        --
        You owe the Oracle a star-spangled dunce cap.
        -- Internet Oracularity Internet Oracularity #1299-08

        Comment

        Working...