Replacement for keyword 'global' good idea? (e.g. 'modulescope' or 'module' better?)

Paolino paolo_veronelli at tiscali.it
Sat Aug 6 13:26:43 EDT 2005


seberino at spawar.navy.mil wrote:
> I've heard 2 people complain that word 'global' is confusing.
> 
> Perhaps 'modulescope' or 'module' would be better?
> 
> Am I the first peope to have thought of this and suggested it?
> 
> Is this a candidate for Python 3000 yet?
> 
> Chris

I don't think the global keyword is useful actually.

What's so special in a module nemespace to be priviledged like that.

The point IMO is accessing names defined somewhere in the enclosing 
namespaces.

def enclosing():
   var=2
   def enclosed():
     outer var=4

this is the base of something useful.

as it is now you neeed

def enclosing():
   class Var:_=2
   def enclosed():
     Var._=4
or like others suggested

def enclosing():
   var=[]
   var[0]=2
   def enclosed():
     var[0]=4
which is like saying python is not working

It's ok to mark non locals,but why var=4 is not searched outside and 
var[0]=4 yes?

I think there is only one or none possible solution to an 'outer' 
statement which is the first bound name matching the 'outer' vars name 
in the chain of enclosing namespaces.

Why every instance doesn't point to its namespace and every namespace to 
its namespace? Unpythonic ?

Illogicities to my eyes or at least non-linerities that makes 'global' 
an interesting strangeness to talk about.

And that namespaces should start being easy sooner or later.


Regards Paolino

	

	
		
___________________________________ 
Yahoo! Mail: gratis 1GB per i messaggi e allegati da 10MB 
http://mail.yahoo.it



More information about the Python-list mailing list