Skip to content

Preserve comprehension scopes in full_name - #2124

Merged
davidhalter merged 1 commit into
davidhalter:masterfrom
Don-Yin:fix-comprehension-full-name
Oct 25, 2026
Merged

davidhalter merged 1 commit into
davidhalter:masterfrom
Don-Yin:fix-comprehension-full-name

Conversation

@Don-Yin

@Don-Yin Don-Yin commented Oct 24, 2026

Copy link
Copy Markdown
Contributor

I reproduced this with the pig_latin example in #1944. I changed comprehension contexts to keep the enclosing scope, so both occurrences of word now report __main__.pig_latin.<comprehension>.word, as suggested. I added that example as a regression test; the separate question about resolving translate remains.

Fixes #1944

I ran the full pytest suite, flake8 and zuban; the regression tests and lint passed, with the existing readline test failure and utils.py type errors reproduced without the change.

The issue's pig_latin example and its full_name output before and after the fix

Signed-off-by: Don Yin <Don_Yin@outlook.com>
@davidhalter

Copy link
Copy Markdown
Owner

How much LLM is this? Do you understand what you have done here?

@Don-Yin

Don-Yin commented Oct 24, 2026

Copy link
Copy Markdown
Contributor Author

Fair question, and quite a lot. I've been trying to give back to the Python tools I rely on (jedi sits under pi-lens which is a code checker I contribute to and use quite heavily, through jedi-language-server)

I search and check the issues where a maintainer has already said what fix they'd accept. I used my agent to find #1944 and draft the patch and tests by your words

I then reviewed the change myself and checked the comparison image in the description against a real run, which you saw above

And yes, I understand it

But to be honest this issue hasn't been causing anyhthing noticible on the side of the pi-lens for me, and not a big deal if you'd rather close this; I'm happy to

@davidhalter
davidhalter merged commit c7ceec7 into davidhalter:master Oct 25, 2026
63 checks passed
@davidhalter

davidhalter commented Oct 25, 2026 •

Copy link
Copy Markdown
Owner

Thanks!


I would personally recommend you to use Zuban instead of Jedi, because that's where most of my work flows into nowadays. The language server is in a much more solid state, offers diagnostics, auto-import and is much faster than Jedi. It's essentially Jedi 2.0 (if you're not using IPython in which case Jedi is still the only option).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

The name for the variables within a list comprehension are incorrect

2 participants