>> It's a work-around for the fact that >> Python doesn't have dedicated syntax to say "operate on the reference >> foo" rather than the value of foo. > > I think Danny's point was that you should not micromanage name bindings at > all. Then Alan added that del is useful for dicts etc. on which I replied > that a method would be sufficient for that.
Yes. Apologies for not being clear. I was thinking of the two recent uses of 'del' showing up on the mailing list in the past week or so. Both of the uses, from different authors, were trying to manually manage name bindings. It made the code harder to understand. In both cases, both uses of 'del' were ineffective. When I'm reading code, I want to know statically what my variables are. By statically, I mean that I should be able to tell, just be reading the code, what the code means, without running it. "What variables are accessible?" is one of the most basic questions I ask myself when I'm reading code. But if we use 'del' on name bindings, that makes the set of accessible variables a dynamic property that, in the most general case, requires us to run the code to figure it out. When I'm trading a static property for a dynamic property, I want to get a useful amount of power for that tradeoff, because it's costly. In my opinion, 'del' on a name binding is just not useful enough to be worth that conceptual cost. 'del' to remove attributes or dictionary key/value pairs is a different matter. I want to constrain my objections to 'del' specifically to its use on name bindings. That all being said: wow. I'm getting a heck of a lot more curmudgeon-y these days. :P _______________________________________________ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options: https://mail.python.org/mailman/listinfo/tutor