|
Re: ugly pie: a "var" keyword: msg#00043python.python-3000.devel
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. |
|
| <Prev in Thread] | Current Thread | [Next in Thread> |
|---|---|---|
| Previous by Date: | Re: Sky pie: a "var" keyword: 00043, Neil Toronto |
|---|---|
| Next by Date: | Re: Sky pie: a "var" keyword: 00043, Marcin 'Qrczak' Kowalczyk |
| Previous by Thread: | Re: Sky pie: a "var" keywordi: 00043, Georg Brandl |
| Next by Thread: | Re: ugly pie: a "var" keyword: 00043, Georg Brandl |
| Indexes: | [Date] [Thread] [Top] [All Lists] |
| News | FAQ | advertise |