Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.python > #28154

Re: get return or locals from "exec" str in "environment"

References <5c488ca5-d730-40c4-b860-7a53201f21ae@googlegroups.com> <mailman.3987.1346365155.4697.python-list@python.org> <599e5709-22ab-4e85-8443-181a2ae19c17@googlegroups.com> <mailman.3991.1346366717.4697.python-list@python.org> <1616cffa-23ea-4377-b415-fa143d0c5e5d@googlegroups.com>
Date 2012-08-31 10:13 +1000
Subject Re: get return or locals from "exec" str in "environment"
From Chris Angelico <rosuav@gmail.com>
Newsgroups comp.lang.python
Message-ID <mailman.3995.1346372034.4697.python-list@python.org> (permalink)

Show all headers | View raw


On Fri, Aug 31, 2012 at 9:54 AM, lucas <sjlukacs@gmail.com> wrote:
> oh, yeah that was perfect.  got it working and it is graceful too.  sorry about the double post, i thought i was only posting to this one.

Hehe, you're still posting to both. I don't see the duplicates myself,
but I'm sure others do. Just pick one and ignore the other.

> one final concern, if this code is running under a function in a multi-threaded, multi-session kind of environment, does exec cross threads or sessions?  like, i am afraid that i will get cross-over or bleeding into other threads or sessions.  does exec do that kind of common memory space wherein i have to be very very careful about executing such code and my daemon crashing or security holes and the like.

Not that I am aware of, and I would be extremely surprised if there
were any. But exec is not the sort of thing you'll normally want to
use. What are you trying to accomplish? There's usually an
alternative.

The only time I've used an exec-like feature is when I'm actually
writing something that loads code from the disk at run-time, such as
my MUD with room files that look like this:

@sdesc Short Description
@ldesc This is the long description of the room, blah blah
@cmds thwap #do_something_when_user_types_thwap()

VERY unusual sort of thing to do - having real code in a data file.

ChrisA

Back to comp.lang.python | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

Re: get return or locals from "exec" str in "environment" Chris Angelico <rosuav@gmail.com> - 2012-08-31 08:19 +1000
  Re: get return or locals from "exec" str in "environment" lucas <sjlukacs@gmail.com> - 2012-08-30 15:25 -0700
    Re: get return or locals from "exec" str in "environment" Chris Angelico <rosuav@gmail.com> - 2012-08-31 08:45 +1000
      Re: get return or locals from "exec" str in "environment" lucas <sjlukacs@gmail.com> - 2012-08-30 16:54 -0700
        Re: get return or locals from "exec" str in "environment" lucas <sjlukacs@gmail.com> - 2012-08-30 16:56 -0700
        Re: get return or locals from "exec" str in "environment" lucas <sjlukacs@gmail.com> - 2012-08-30 16:56 -0700
        Re: get return or locals from "exec" str in "environment" Chris Angelico <rosuav@gmail.com> - 2012-08-31 10:13 +1000
      Re: get return or locals from "exec" str in "environment" lucas <sjlukacs@gmail.com> - 2012-08-30 16:54 -0700
  Re: get return or locals from "exec" str in "environment" lucas <sjlukacs@gmail.com> - 2012-08-30 15:25 -0700

csiph-web