inducer / inducer/pudb

Names not defined in list comprehension in the IPython shell

Open
#103 34 comments 43 reactions 0 assignees View on GitHub
Bug
Dominant language
Python
Stars
3.2k
Forks
245
Avg merge
13m
Merged PRs (30d)
5

Description

In the IPython shell, you can't seem to access names from within list comprehensions:

``` py
In [16]: a = 1

In [17]: [a for i in range(10)]
---------------------------------------------------------------------------
NameError Traceback (most recent call last)
/Users/aaronmeurer/Documents/Continuum/conda/conda/resolve.py in ()
----> 1 [a for i in range(10)]

/Users/aaronmeurer/Documents/Continuum/conda/conda/resolve.py in (.0)
----> 1 [a for i in range(10)]

NameError: global name 'a' is not defined
```

It doesn't matter if the name was defined within the session or if it comes from the function you are debugging. This is debugging within a function scope, if that matters.

Contributor guide

No contributing guide indexed for this repository

Research direction

Start by reproducing the list-comprehension failure in the IPython shell while debugging a function, using the example in the issue. Trace how the debugger evaluates expressions and resolves session or function-scope names. Done means names available in the relevant scope can be accessed from list comprehensions without the reported NameError.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
devtools
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.