On 23 June 2015 at 05:33, Nick Coghlan <ncogh...@gmail.com> wrote:
> > > Also, since classes inside functions are commonly used in unit tests (at > > least mine :-), I worry that *any* changes in this behavior might break > > working code (no matter how much that "working" could be considered an > > accident, it's still going to be a bear to debug if this happens to you). > > Agreed - I think any change here would need to go through a > deprecation period where we warned about cases where LOAD_NAME would > be changed to LOAD_CLASSDEREF and there was a nonlocal defined with > that name. > > Since it's trivial easy to workaround by renaming a local variable to > use a name that differs from the nested class attribute, I'd also be > entirely happy with leaving the current behaviour as an obscure quirk > - I'm only +0 on changing it, and also +0 on declaring it "not worth > the hassle of changing". > > This is also my attitude on this issue. Looks like everyone agrees that this is a strange behavior, but not strange enough to be changed.
_______________________________________________ Python-Dev mailing list Python-Dev@python.org https://mail.python.org/mailman/listinfo/python-dev Unsubscribe: https://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com