It seems noone liked (or remembered) an idea I proposed last february, but I'm going to repost it anyway: How about adding a "rebinding" operator, for example spelled ":=": a := 2 It would mean: bind the value 2 to the nearest scope that defines 'a'. Original post: http://mail.python.org/pipermail/python-dev/2003-February/032764.html A better summary by someone else who liked it: http://groups.google.com/groups?selm=mailman.1048248875.10571.python- list%40python.org Advantages: no declarative statement (I don't like global much to begin with, but much less for scope declarations other that what it means now). It's a nice addition to the current scoping rule: an assignment IS a scope declaration. Possible disadvantage: you can only rebind to the nearest scope that defines the name. If there's a farther scope that also defines that name you can't reach that. But that's nicely symmetrical with how _reading_ values from nested scopes work today, shadowing is nothing new. Ideally, augmented assignments would also become "rebinding". However, this may have compatibility problems. Just
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4