Compiler

Discussion in 'Python' started by Steven, Apr 26, 2004.

  1. Steven

    Steven Guest

    Hi folks,

    Just curious, is there a python compiler?
    Or something that creates bytecode, like java?

    Regards,

    Steven
     
    Steven, Apr 26, 2004
    #1
    1. Advertising

  2. Steven

    Peter Hansen Guest

    Steven wrote:

    > Just curious, is there a python compiler?
    > Or something that creates bytecode, like java?


    Yes. They are the same thing. Javac compiles Java source
    to Java bytecode. C compilers compile C source to
    machine-specific bytecode (called machine code). Python
    compiles Python source to Python bytecode. The main
    difference is that Python does this transparently behind
    your back whenever the source has change, while many other
    languages that do it require a separate manual step...

    -Peter
     
    Peter Hansen, Apr 27, 2004
    #2
    1. Advertising

  3. Steven

    Maurice LING Guest

    Peter Hansen wrote:
    > Steven wrote:
    >
    >> Just curious, is there a python compiler?
    >> Or something that creates bytecode, like java?

    >
    >
    > Yes. They are the same thing. Javac compiles Java source
    > to Java bytecode. C compilers compile C source to
    > machine-specific bytecode (called machine code). Python
    > compiles Python source to Python bytecode. The main
    > difference is that Python does this transparently behind
    > your back whenever the source has change, while many other
    > languages that do it require a separate manual step...
    >
    > -Peter


    hi,

    i was wondering just how different is the python bytecode from the java
    bytecode? is there a specification for python virtual machine or sort? i
    can foresee a lot of interesting projects and uses that can stem from
    this specification.

    maurice
     
    Maurice LING, Apr 27, 2004
    #3
  4. Steven

    Roger Binns Guest

    Maurice LING wrote:
    > i was wondering just how different is the python bytecode from the java
    > bytecode? is there a specification for python virtual machine or sort? i
    > can foresee a lot of interesting projects and uses that can stem from
    > this specification.


    I recommend reading all the posts in this earlier thread:

    http://groups.google.com/groups?th=f20ad34ef1157bcb

    It largely overlaps with what you are thinking and what your next
    questions would be :)

    Roger
     
    Roger Binns, Apr 27, 2004
    #4
  5. Steven

    Terry Reedy Guest

    "Maurice LING" <> wrote in message
    news:408db4fb$...
    > i was wondering just how different is the python bytecode from the java


    For Jython, 'python bytecode' is jave bytecode.


    > bytecode? is there a specification for python virtual machine or sort?


    For CPython, see the documentation for the CPython-specific dis (assembly)
    module. Note that the details are x.y version specific, subject to change,
    and not part of the language specification. For 'interesting projects'
    that have been posted, try googling for Python bytecode hacks.

    Terry J. Reedy
     
    Terry Reedy, Apr 27, 2004
    #5
  6. You can do this:

    python -c "import py_compile; py_compile.compile( \"foo.py\", \"foo.pyc\" )"

    ...which will create foo.pyc *only*, and will not compile any other
    ..py files imported by foo.py.

    Steven wrote:
    > Hi folks,
    >
    > Just curious, is there a python compiler?
    > Or something that creates bytecode, like java?
    >
    > Regards,
    >
    > Steven
     
    Rick L. Ratzel, Apr 27, 2004
    #6
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Yan
    Replies:
    0
    Views:
    1,172
  2. Jack Wright
    Replies:
    5
    Views:
    663
    Shiv Kumar
    Jan 19, 2004
  3. Ram
    Replies:
    0
    Views:
    2,935
  4. Andrey Batyuck

    Compiler compiler with C++ as output

    Andrey Batyuck, May 11, 2004, in forum: C++
    Replies:
    3
    Views:
    460
    Frederik Hertzum
    May 17, 2004
  5. RickMuller
    Replies:
    4
    Views:
    752
    Alexey Shamrin
    Mar 26, 2005
Loading...

Share This Page