Peter Otten wrote:
> Clearly more elegant than:
>
>
print open(filename).read()
> b = a
>
dummy = 42
names = []
while 1:
> ... ns = dict((n, dummy) for n in names)
> ... try:
> ... execfile(filename, ns)
> ... except Name
Mikael Olofsson wrote:
> Peter Otten wrote:
>> To feed an arbitrary mapping object to execfile() you need to upgrade to
>> Python 2.4.
>
> Thanks! As clear as possible. I will do that.
>
> FYI: I think I managed to achieve what I want in Py2.3 using the
> compiler module:
>
> def getNamesFr
Peter Otten wrote:
> To feed an arbitrary mapping object to execfile() you need to upgrade to
> Python 2.4.
Thanks! As clear as possible. I will do that.
FYI: I think I managed to achieve what I want in Py2.3 using the
compiler module:
def getNamesFromAstNode(node,varSet):
if node._
Mikael Olofsson wrote:
> This is in Python 2.3.4 under WinXP.
To feed an arbitrary mapping object to execfile() you need to upgrade to
Python 2.4.
http://docs.python.org/dev/lib/built-in-funcs.html#l2h-26
Peter
--
http://mail.python.org/mailman/listinfo/python-list
Hi!
This is in Python 2.3.4 under WinXP.
I have a situation where I think changing the behaviour of a namespace
would be very nice. The goal is to be able to run a python file from
another in a separate namespace in such a way that a NameError is not
raised if a non-existing variable is used i