allocate TWO interpreters in a C program?

Discussion in 'Python' started by Torsten Mohr, Apr 4, 2004.

  1. Torsten Mohr

    Torsten Mohr Guest

    Hi,

    i can embed Perl into a C program and allocate MORE THAN ONE
    interpreter if i want to. They are independent from each other.

    Is this also possible in Python?


    Best regards,
    Torsten.
     
    Torsten Mohr, Apr 4, 2004
    #1
    1. Advertising

  2. Torsten Mohr

    Andrew Dalke Guest

    Torsten Mohr:
    > i can embed Perl into a C program and allocate MORE THAN ONE
    > interpreter if i want to. They are independent from each other.
    >
    > Is this also possible in Python?


    As no one else has answered, I'll take a stab at it, on the assumption
    that a wrong answer will be corrected.

    No, it isn't possible. Various bits of state, like exceptions, are stored
    in global variable (actually thread global I think). I think there is other
    global state, like sys.modules which contains all of the imported modules.

    There are experimental systems like PyPy which can provide
    independent interpreters but I know little about them.

    Andrew
     
    Andrew Dalke, Apr 5, 2004
    #2
    1. Advertising

  3. In article <4Vicc.16932$>, Andrew Dalke wrote:
    > Torsten Mohr:
    >> i can embed Perl into a C program and allocate MORE THAN ONE
    >> interpreter if i want to. They are independent from each other.
    >>
    >> Is this also possible in Python?

    >
    > As no one else has answered, I'll take a stab at it, on the assumption
    > that a wrong answer will be corrected.
    >
    > No, it isn't possible. Various bits of state, like exceptions, are stored
    > in global variable (actually thread global I think). I think there is other
    > global state, like sys.modules which contains all of the imported modules.
    >
    > There are experimental systems like PyPy which can provide
    > independent interpreters but I know little about them.
    >
    > Andrew
    >
    >
    >


    Actually, more than one *sub*-interpreter can be instantiated in a single C program.

    http://python.org/doc/current/api/initialization.html

    However, upon close reading, it's hardly as independent as you might hope.

    But for fun also read:

    http://www.python.org/peps/pep-0311.html

    since it seems to imply that multiple subinterpreters are not a frequently used feature.

    Dave
     
    David E. Konerding DSD staff, Apr 5, 2004
    #3
    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. Vbfoo Bar
    Replies:
    1
    Views:
    351
    Benjamin Niemann
    Sep 14, 2004
  2. sonicSpammersGoToHellSmooth

    Newbie question: Sub-interpreters for CAD program

    sonicSpammersGoToHellSmooth, Aug 24, 2005, in forum: Python
    Replies:
    11
    Views:
    488
    David MacQuigg
    Aug 29, 2005
  3. Replies:
    9
    Views:
    925
    Rhamphoryncus
    Apr 13, 2008
  4. grbgooglefan
    Replies:
    24
    Views:
    1,875
    Graham Dumpleton
    Sep 8, 2009
  5. Torsten Mohr
    Replies:
    6
    Views:
    121
    Martien Verbruggen
    Dec 31, 2003
Loading...

Share This Page