This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author Assume_Away
Recipients Assume_Away, paul.moore, steve.dower, terry.reedy, tim.golden, zach.ware
Date 2016-12-19.03:17:19
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1482117439.83.0.807887809751.issue29008@psf.upfronthosting.co.za>
In-reply-to
Content
class MyClass:
    a_dict = {'key':'value'}
    r_dict = {a_dict[k]:k for k in a_dict}
    
throws the error: 

Traceback (most recent call last):
  File "C:/Users/D/AppData/Local/Programs/Python/Python35-32/deleteme.py", line 1, in <module>
    class MyClass:
  File "C:/Users/D/AppData/Local/Programs/Python/Python35-32/deleteme.py", line 3, in MyClass
    r_dict = {a_dict[k]:k for k in a_dict}
  File "C:/Users/D/AppData/Local/Programs/Python/Python35-32/deleteme.py", line 3, in <dictcomp>
    r_dict = {a_dict[k]:k for k in a_dict}
NameError: name 'a_dict' is not defined
History
Date User Action Args
2016-12-19 03:17:19Assume_Awaysetrecipients: + Assume_Away, terry.reedy, paul.moore, tim.golden, zach.ware, steve.dower
2016-12-19 03:17:19Assume_Awaysetmessageid: <1482117439.83.0.807887809751.issue29008@psf.upfronthosting.co.za>
2016-12-19 03:17:19Assume_Awaylinkissue29008 messages
2016-12-19 03:17:19Assume_Awaycreate