Re: [Python-Dev] Non implementation dependent access to calling scope

2007-03-10 Thread Guido van Rossum
Looks like you misunderstand what's going on. sys._getframe() *intentionally* smells like a hack, becase we don't *want* you to feel comfortable using it. Its mere existence may constrain other Python implementations from optimizing the code they generate; it is a compromise to enable those project

Re: [Python-Dev] Non implementation dependent access to calling scope

2007-03-10 Thread Michael Foord
Martin v. Löwis wrote: > Michael Foord schrieb: >> Hello all, >> >> I realise that this may be more relevant to Python ideas, in which >> case feel free to ignore this (and my apologies). >> >> I occasionally see code looking (something) like : >> >> >> calling_scope = sys._getframe(1).f_globals['

Re: [Python-Dev] Non implementation dependent access to calling scope

2007-03-10 Thread Martin v. Löwis
Michael Foord schrieb: > Hello all, > > I realise that this may be more relevant to Python ideas, in which case > feel free to ignore this (and my apologies). > > I occasionally see code looking (something) like : > > > calling_scope = sys._getframe(1).f_globals['__name__'] > > This looks and

[Python-Dev] Non implementation dependent access to calling scope

2007-03-10 Thread Michael Foord
Hello all, I realise that this may be more relevant to Python ideas, in which case feel free to ignore this (and my apologies). I occasionally see code looking (something) like : calling_scope = sys._getframe(1).f_globals['__name__'] This looks and smells like a hack (not least because of the