"no variable or argument declarations are necessary."

Brian Quinlan brian at sweetapp.com
Wed Oct 5 13:27:51 CEST 2005


Paul Rubin wrote:
>>Which is evaluated at runtime, does not require that the actual global
>>variable be pre-existing, and does not create the global variable if
>>not actually assigned. I think that is pretty different than your
>>proposal semantics.
> 
> 
> Different how?

Aren't you looking for some of compile-time checking that ensures that 
only declared variables are actually used? If so, how does global help?

>>Your making this feature "optional" contradicts the subject of this
>>thread i.e. declarations being necessary.  
> 
> They're necessary if you enable the option.

OK. Would it work on a per-module basis or globally?

> def do_add(x->str, y->str):
>       return '%s://%s' % (x, y)
> 
> def do_something(node->Node):
>       if node.namespace == XML_NAMESPACE:
>           return do_add('http://', node.namespace)
>       elif node.namespace == ...

Wouldn't an error be generated because XML_NAMESPACE is not declared?

And I notice that you are not doing any checking that "namespace" is a 
valid attribute of the node object. Aren't the typos class of error that 
you are looking to catch just as likely to occur for attributes as 
variables?

Cheers,
Brian




More information about the Python-list mailing list