donkirkby / donkirkby/live-py-plugin

Display generator expressions

Open
#156 1 comment 0 reactions 0 assignees View on GitHub
enhancement
Dominant language
Python
Stars
302
Forks
63
Avg merge
6h 50m
Merged PRs (30d)
2

Description

I think this needs more thought, but this is a first attempt. Generator expressions aren't currently displayed, because you don't know the value when they are assigned. However, the report builder could build up the display as the generator is consumed by later code.

Here's the current display for a small example:

s = 'xYz' | s = 'xYz'
a1 = (c.upper() for c in s) |
a2 = [c.upper() for c in s] | a2 = ['X', 'Y', 'Z']
a3 = list(a1) | a3 = ['X', 'Y', 'Z']

A display like `a1 = ('X', 'Y', 'Z')` might be confusing, because that looks like a tuple. This is the best I can think of:

s = 'xYz' | s = 'xYz'
a1 = (c.upper() for c in s) | a1 = gen('X', 'Y', 'Z')
a2 = [c.upper() for c in s] | a2 = ['X', 'Y', 'Z']
a3 = list(a1) | a3 = ['X', 'Y', 'Z']

Contributor guide

Open the contributing guide

Research direction

The issue names no files or tests. Start by tracing the report builder's handling of generator expressions and compare the displayed examples; done means choosing and implementing an unambiguous representation that reflects consumption without presenting a generator as a tuple.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
tooling
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.