Paddy wrote:
I do in fact have the case you mention. I am writing a module that will
manipulate functions of global variables where the functions are
defined in another module.
Would it be possible to have your functions take arguments instead of globals? That would seem to be
a better design.
Ke
Leif wrote:
" If globals were deeply substituted when using eval, the program would
presumably print "42\n24", which would be far from intuitive. If you
limit the deep substitution to functions in the same module, you're
creating a confusing special case. "
I guess I need outside opinions on what
Paddy wrote:
I had to do as you suggest but I was thinking either it was a kludge,
and there should be a 'deep' substitution of globals, or that there
was a good reason for it to work as it does and some magician would
tell me.
If there was deep substitution of globals, how would functions importe
Thanks Kent for your reply.
I had to do as you suggest but I was thinking either it was a kludge,
and there should be a 'deep' substitution of globals, or that there was
a good reason for it to work as it does and some magician would tell
me.
Oh, the third reason could be that it was first implimen
Paddy wrote:
Hi,
I got tripped up on the way eval works with respect to modules and
so wrote a test.
It seems that a function carries around knowledge of the globals()
present
when it was defined. (The .func_globals attribute)?
When evaluated using eval(...) the embedded globals can be overridden
w
I have had no reply so on revisiting this I thought I would re-submit
it and point out that there is a question way down at the end :-)
Thanks.
= Original Post =
Hi,
I got tripped up on the way eval works with respect to modules and
so wrote a test.
It seems that a function carries arou
Hi,
I got tripped up on the way eval works with respect to modules and
so wrote a test.
It seems that a function carries around knowledge of the globals()
present
when it was defined. (The .func_globals attribute)?
When evaluated using eval(...) the embedded globals can be overridden
with
the one