Le lundi 09 octobre 2006 à 12:49 +0200, Georg Brandl a écrit :
> They wouldn't be "local" unless declared with "var", I assume.

Which is a sure way to cause all kind of frigging bugs if you forget to
put "var", because then your variable is global, which is fine when it's
a plain int or string, not when it's a complex object whose mere
existence changes lots of things.

Javascript and Perl both suffer from this stupid design (Perl even
invented "use strict" to circumvent it), please don't bring it to
Python :-(

(believe me, there are lots of reasons to hate Perl, but strange bugs
that arise silently when you forgot "my" and thus retain some old value
in a global variable is really one of the most horrible ones I
encountered)


Besides, in a well-written program, you will mostly access local
variables (and attributes and methods), so let's make the clean common
case easy to type and unobstrusive, and the rare dirty case easy to
spot. Lots of "global" in a Python program immediately hint at dirty
code.

Regards

Antoine.


_______________________________________________
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

Reply via email to