Re: "no variable or argument declarations are necessary."
Available news archives: comp.lang.tcl - comp.lang.python - comp.security.firewalls - sci.crypt - comp.lang.php - comp.lang.javascript
Google
 
Web news.hping.org


comp.lang.python archive

Re: "no variable or argument declarations are necessary."

From: Brian Quinlan <brian@sweetapp.com>
Date: Wed Oct 05 2005 - 13:27:51 CEST

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
Received on Sat Oct 15 04:10:11 2005