"no variable or argument declarations are necessary."

marduk usenet at marduk.letterboxes.org
Tue Oct 4 19:03:32 EDT 2005


On Tue, 2005-10-04 at 11:43 -0700, Paul Rubinhttp: wrote:
> What's the big deal?  Perl has an option for flagging undeclared
> variables with warnings ("perl -w") or errors ("use strict") and Perl
> docs I've seen advise using at least "perl -w" routinely.  Those
> didn't have much impact.  Python already has a "global" declaration;
> how does it de-Pythonize the language if there's also a "local"
> declaration and an option to flag any variable that's not declared as
> one or the other? 

I would be happy with a "local" option. e.g.

def myfunc():
   local spam = ...
   local eggs = ...
   global juice

   breakfast = juice + spam + eggs # raises an exception (undeclared
breakfast)


What I'm *afraid* of is:

def myfunc(MyClass myparam):
   int spam = 6
   str eggs

   # etc

i.e. typed declarations and type checking.  This would annoy the heck
out of me. 




More information about the Python-list mailing list