[issue21161] list comprehensions don't see local variables in pdb in python3

Jurko Gospodnetić report at bugs.python.org
Thu Apr 10 15:01:46 CEST 2014


Jurko Gospodnetić added the comment:

Just ran into this problem and it's sooooo uncomfortable
researching dynamic structures at run-time using PDB
without this. :-(

As a workaround, you can use a trick similar to this one
to 'import' your locals into the list comprehension body:

[l['r'](x) for l in (locals(),) for x in l['some_local']]

assuming 'r' & 'some_local' are two local variables in
your surrounding scope.

Ugly, but at least it can be made/forced to work if needed...

Best regards,
  Jurko Gospodnetić

----------
nosy: +Jurko.Gospodnetić
versions: +Python 3.4, Python 3.5

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue21161>
_______________________________________


More information about the Python-bugs-list mailing list