Re: Changing behaviour of namespaces - solved, I think

2006-09-21 Thread Mikael Olofsson
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

Re: Changing behaviour of namespaces - solved, I think

2006-09-21 Thread Peter Otten
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

Re: Changing behaviour of namespaces - solved, I think

2006-09-21 Thread Mikael Olofsson
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._