[prev in list] [next in list] [prev in thread] [next in thread] 

List:       python-3000
Subject:    [Python-3000] replace globals() and global statement
From:       greg.ewing () canterbury ! ac ! nz (Greg Ewing)
Date:       2006-07-03 23:34:17
Message-ID: 44A9A979.5030402 () canterbury ! ac ! nz
[Download RAW message or body]

BJ?rn Lindqvist wrote:
> I think the fix for that is to remove the "scope inheritance." I.e:
> 
> cache = None
> def init():
>     if not cache:
>         pass
> 
> Throws a NameError because cache is not declared in function init's
> scope.

And do you want

   def f():
     print "Eff!"

   def g():
     f()

   g()

to throw a NameError, too? If not, how do you tell
the difference?

--
Greg

[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic