> > cache = None > > def init(): > > if not cache: > > pass > > > > Throws a NameError because cache is not declared in function init's > > scope. So you would be forced to write: > > > > cache = None > > def init(): > > if not global.cache: > > global.cache = "foobar" > > > > I like the symmetry with self in classes. YMMV > > That can't work because imported names are also globals, as are > classes and functions defined in the same module.
I... didn't think about that. Thanks for crushing my idea. :) -- mvh Björn _______________________________________________ Python-3000 mailing list [email protected] http://mail.python.org/mailman/listinfo/python-3000 Unsubscribe: http://mail.python.org/mailman/options/python-3000/archive%40mail-archive.com
