[Python-Dev] The baby and the bathwater (Re: Scoping, augmented assignment, 'fast locals' - conclusion)

Boris Borcic bborcic at gmail.com
Mon Jun 19 09:34:06 EDT 2006


Hello, just a couple points

On 6/17/06, Josiah Carlson <jcarlson at uci.edu> wrote:

[errors involving the shadowing of a variable by another]

 > > Of course everybody makes errors, but it doesn't follow from this, that
 > > all make the same errors, or should.
 >
 > If I implied that everyone has made this particular mistake, I'm sorry.
 > I was trying to say that I made error X, and that I don't believe that
 > I'm a unique butterfly to have made error X.

Well, don't be so certain you aren't the exceptional butterfly as regards the 
general issue - if not the error itself, perhaps the onlook. It deemed on me 
over the week-end that all three of me, you, and Guido indeed, have been acting 
out our own names in some way. Guido van Rossum's case is most direct : "The 
guide by red lights". Me, well, the issue of comparing slightly different 
versions is kind of written in the relationship of my first name and my family 
name. As for you, your name is exceptional in that it makes your initials shadow 
those of Jesus-Christ (a "builtin" if any); and if you go to the bottom of it, 
that collision of identifiers goes slightly further than just the initials.

Is the idea that people may get subtly influenced by their own names, new to you 
? One's name is to language and thought as one's home is to space...

"Bill Gates" has always struck me as an injunction...

...
 > One consequence of either a fixed or variable set of non-shadowables is
 > that you would need to use arbitrarily unique names for lexically nested
 > for loops, and/or specify that such variables are not referencing parent
 > scopes.
 >
 > def foo(...):
 >     for i in ...:
 >         ...
 >     def bar(...):
 >         ...
 >         for i in ...: #unallowed
 >             ...
 >     ...
 >
 > You can replace the 'i' with a name of your choosing.  Is such
 > desireable?  I would say no for the same reasons why I said no in
 > regards to being able to explicitly name variables in different levels
 > within lexically nested scopes: I would argue that one shouldn't be
 > using closures in the first place, so encouraging its use with a syntax
 > is right out the door.  But that's my opinion, and not really relevant
 > to the current discussion.

I am surprised you would count the obligation of picking distinct names as an 
encouragement to use lexically nested scopes; compared to the current situation, 
it is in fact more -restrictive- and should thus count as -discouraging-. And 
imo picking different names for loop variables in such a case is rather a good 
thing. But, again, "more good ain't more ease".

Nit : retrospectively I believe I let you push me into equating "closures" with 
"lexically nested function scopes", but am I right in believing "closures" in 
fact implies functions defined with nested scopes be exported/returned outside 
of the parent scope ?

...
 > I don't believe that Guido is the end-all-be-all of language
 > design, but I do find that I agree with him more often than not (though
 > perhaps not vv), and at least in regards to this particular
 > functionality, I side with the 'status quo' end of things.

I dont understand the "(though perhaps not vv)". Is the "vv" intended to stand 
for "you" (eg, myself) ? I've always liked Guido's Python a lot, and part of it 
has to do with the ante-Bill-Gates "magic of programming". For a looong while, 
my consistent experience with  the "Where do you want to go today ?" MS slogan - 
as illustrated by MS products - has been that whenever you tried to find 
imaginative programming solutions (as opposed to "obeying the designer's obvious 
expectation despite his claim he lets you free") you would collide with glass 
walls... or end up at a "billing gate" (=some commercial extension product). 
I've had slightly better experience in later years.

Python always had a completely different feel, more like the restitution of the 
old magic to new generations. (btw, Prolog is the language that most gave me 
that feeling of "allowing spectacular escapes from the designer's obvious 
expectations", so it is not a matter of constraints - prolog is quite 
constraining. I think it has to do with consistency and humbleness of a design 
that is not trying to out-think its users).

As concerns the case in point, I think it was unfortunate that you would not let 
come into the open that the (risk of) inadvertent capture of builtins by 
un-nested function scopes was critical to the shape of the "feature". Indeed, 
speaking of "status quo ante" : augmented assignments arrived with Python 2.0, 
while nested scopes where first introduced with 2.1.

 >
 > Have a good weekend,

Thank you. I had a good weekend. I hope you too. And together with my thanks for 
your efforts, please recieve my apologies for temper...

 >  - Josiah
 >
 > [1] http://www.csmonitor.com/2006/0515/p13s01-stct.html

...as this seems to imply you would.

Boris
--
"On naît tous les mètres du même monde"



More information about the Python-list mailing list