New submission from Corey Farwell: ``` class A: B = range(10) C = frozenset([4, 5, 6]) D = list(i for i in B) E = list(i for i in B if i in C) ```
``` coreyf@frewbook-pro /tmp [1]> python3 a.py Traceback (most recent call last): File "a.py", line 1, in <module> class A: File "a.py", line 5, in A E = list(i for i in B if i in C) File "a.py", line 5, in <genexpr> E = list(i for i in B if i in C) NameError: name 'C' is not defined ``` Why should I be able to access B but not C? ---------- components: Interpreter Core messages: 264819 nosy: corey priority: normal severity: normal status: open title: Unintuitive error when using generator expression in class property type: behavior versions: Python 2.7, Python 3.2, Python 3.3, Python 3.4, Python 3.5 _______________________________________ Python tracker <rep...@bugs.python.org> <http://bugs.python.org/issue26951> _______________________________________ _______________________________________________ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com