Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

python: variable named _ does not show in Variables pane #3366

Open
isabelizimm opened this issue Jun 3, 2024 · 1 comment
Open

python: variable named _ does not show in Variables pane #3366

isabelizimm opened this issue Jun 3, 2024 · 1 comment
Assignees
Labels
area: variables Issues related to Variables category. bug Something isn't working lang: python

Comments

@isabelizimm
Copy link
Contributor

_ can be used as a variable name in Python (seen occasionally as a throwaway variable when developing). We likely hide this variable name since it is part of the ipython user namespace, but it was surprising to not see it populated when I set it. To reproduce:

>>> _ = 1
>>> print(_)
1

You'll see that _ does get set to 1 correctly, but it won't be shown in Variables.

@isabelizimm isabelizimm added bug Something isn't working area: variables Issues related to Variables category. lang: python labels Jun 3, 2024
@petetronic petetronic added this to the Release Candidate milestone Jun 10, 2024
@juliasilge
Copy link
Contributor

We believe this is filtered out here:

@austin3dickey austin3dickey self-assigned this Jan 27, 2025
austin3dickey added a commit that referenced this issue Feb 21, 2025
…6297)

<!-- Thank you for submitting a pull request.
If this is your first pull request you can find information about
contributing here:
  * https://github.com/posit-dev/positron/blob/main/CONTRIBUTING.md

We recommend synchronizing your branch with the latest changes in the
main branch by either pulling or rebasing.
-->

<!--
  Describe briefly what problem this pull request resolves, or what
  new feature it introduces. Include screenshots of any new or altered
  UI. Link to any GitHub issues but avoid "magic" keywords that will
  automatically close the issue. If there are any details about your
  approach that are unintuitive or you want to draw attention to, please
  describe them here.
-->
Addresses #3366. This PR changes the Variables pane behavior in the
Python extension so that it no longer hides the `_` variable if it was
explicitly changed by the user.

An example: type `_ = 1` into the console. Before this change, `_`
wouldn't show up. Now it does.


### Release Notes

<!--
Optionally, replace `N/A` with text to be included in the next release
notes.
The `N/A` bullets are ignored. If you refer to one or more Positron
issues,
these issues are used to collect information about the feature or
bugfix, such
as the relevant language pack as determined by Github labels of type
`lang: `.
  The note will automatically be tagged with the language.

These notes are typically filled by the Positron team. If you are an
external
  contributor, you may ignore this section.
-->

#### New Features

- N/A

#### Bug Fixes

- Allowed `_` to show up in the Python Variables pane if defined by the
user. (#3366)


### QA Notes

<!--
  Add additional information for QA on how to validate the change,
  paying special attention to the level of risk, adjacent areas that
  could be affected by the change, and any important contextual
  information not present in the linked issues.
-->

Try messing around with the `_` variable; it should work like other
variables in the Variables pane. Examples:
```py
_ = 1
_ = 2
_ = [1] * 1000
del _
from ibis import _
```
(the last one requires `pip install ibis-framework`)

@:console @:variables
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area: variables Issues related to Variables category. bug Something isn't working lang: python
Projects
None yet
Development

No branches or pull requests

4 participants