Thanks, Alex. Again your pedagogical abilities clarifies python's strangeness for me. Not that python is strange, just that I have to understand, why it's not. Alex Martelli wrote: > Binding (and re-binding) is most often done through the so-called > "assignment statement": the reference that is affected is indicated > by what is on the left of the '=' sign in such a statement, the > object being bound, by what is on the right of said sign. So that in fact should be okay as I did.... > The body of this 'apply' is just re-binding a reference which > happens to be a local variable of this apply function. It is, ...but this is the problem. I didn't (hmm, don't) really understand lambda's. Now I see how it works. The keyword arguments in the call are put into the local namespace, and of course they cannot be changed in the global then. > I _think_ you mean you are now doing something like: > def apply(self,button,buttons,setting): > setting[0] = button.cget('text') Sure. > (Or, you could use a 'grab-bag instance object' -- it > does not have to be a module-object; see for example > http://www.activestate.com/ASPN/Python/Cookbook/Recipe/52308). > Still, I think I am too much of a Fortran programmer to really understand why it is not possible to change the binding of a reference (correct term?) to another object just by assignment. Is it due to some decisions for the implementation of python or is it because of some technical reasons having to do with oo-languages? -- Brian http://www.et.dtu.dk/energysystems http://www.rk-speed.dk http://fiduso.dk http://sunsite.auc.dk/dk-tug \TeX, tak
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