|
Re: ugly pie: a "var" keyword: msg#00045python.python-3000.devel
Antoine Pitrou wrote: > 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 :-( No contradiction from my side. > (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. Full ACK. Georg |
|
| <Prev in Thread] | Current Thread | [Next in Thread> |
|---|---|---|
| Previous by Date: | Re: Sky pie: a "var" keyword: 00045, Marcin 'Qrczak' Kowalczyk |
|---|---|
| Next by Date: | Re: ugly pie: a "var" keyword: 00045, Marcin 'Qrczak' Kowalczyk |
| Previous by Thread: | Re: ugly pie: a "var" keywordi: 00045, Antoine Pitrou |
| Next by Thread: | Re: ugly pie: a "var" keyword: 00045, Marcin 'Qrczak' Kowalczyk |
| Indexes: | [Date] [Thread] [Top] [All Lists] |
| News | FAQ | advertise |