[Python-ideas] Globalize lonely augmented assignment
Georg Brandl
g.brandl at gmx.net
Sun Jun 13 12:12:52 CEST 2010
More information about the Python-ideas mailing list
Sun Jun 13 12:12:52 CEST 2010
- Previous message: [Python-ideas] Globalize lonely augmented assignment
- Next message: [Python-ideas] Globalize lonely augmented assignment
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Am 13.06.2010 02:19, schrieb Greg Ewing: > Georg Brandl wrote: > >> a += b is equivalent to >> a = a.__iadd__(b) > > It's not quite the same as that, because if a stands for an > indexed expression, the index is only evaluated once. > >> With the proposal, it would be much more complicated and dependent on >> the context: "... it's the same as <code>, but if the name would only >> be made a local by augmented assignment statements, it's automatically >> made nonlocal if there's a matching non-local binding, or global >> otherwise." > > It doesn't have to be as complicated as that -- you only need > to add something like "except that if the LHS is a bare name, > it does not imply that the name is local." Any context-dependent > effects then follow from the existing scope rules. They don't -- as I said in the other mail, there is no "existing scope rule" that covers assignments that are implicitly global or nonlocal. Georg -- Thus spake the Lord: Thou shalt indent with four spaces. No more, no less. Four shall be the number of spaces thou shalt indent, and the number of thy indenting shall be four. Eight shalt thou not indent, nor either indent thou two, excepting that thou then proceed to four. Tabs are right out.
- Previous message: [Python-ideas] Globalize lonely augmented assignment
- Next message: [Python-ideas] Globalize lonely augmented assignment
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
More information about the Python-ideas mailing list