[issue28419] List comprehension in class scope does not have access to class scope

2016-10-11 Thread David Eyk

New submission from David Eyk:

I've discovered what appears to be a scoping bug in Python 3.5.1, where the 
class scope is not available inside a list comprehension defined in the class 
scope.

Attached is a simple example script, also available at the following gist:

https://gist.github.com/eykd/c63a7cf760a538ee8bc3828362ed12e3

As demonstrated, the script runs fine in Python 2.7.11, but fails in 3.5.1. I 
can't think of any good reason why the class scope wouldn't be available to the 
comprehension scope, but if there is a reason, I'm keen to know what it is!

--
components: Interpreter Core
files: comp_scope.py
messages: 278505
nosy: David Eyk
priority: normal
severity: normal
status: open
title: List comprehension in class scope does not have access to class scope
versions: Python 3.5
Added file: http://bugs.python.org/file45062/comp_scope.py

___
Python tracker 
<http://bugs.python.org/issue28419>
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue28419] List comprehension in class scope does not have access to class scope

2016-10-11 Thread David Eyk

David Eyk added the comment:

Thanks for the pointer. That seems weird and arbitrary when you think of it in 
terms of scope, but what can you do?

All the same, thanks for the quick response. :)

--

___
Python tracker 
<http://bugs.python.org/issue28419>
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com