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

[Feature Request] new column in Variable Inspector to show any comment on same line as definition #256

Open
RGD2 opened this issue Nov 3, 2022 · 1 comment

Comments

@RGD2
Copy link

RGD2 commented Nov 3, 2022

I do data science, and need to be precise. But it's a lot of 'write once' linear script code.

So, I make a concerted effort to comment on the same line as each assignment: typically I'll do this first. The line will have a short phrase saying what the thing is, and will include what units it is in.

Then, I'll typically just name the variable with a three or four letter acronynym formed from that phrase, and the units (slashes replaced with p for 'per'), with an underscore to separate them.

I know this is not 'pythonic', but I don't want long lines full_of_long_variable_names, the equations / calculations are long enough already. We often end up needing to change units for the same variable, so it's easier and clearer to read that code this way, with relatively terse variables as mnemonics, but including the units.

If there's any confusion about what a variable is, jumping to where it was defined and reading the comment clears it right up.

The feature request is this: Can Variable Inspector include an optional column after the name of the varible, to be populated by whatever string is after a # on the same source code line?

This could be extended to preview of a function's docstring, if included, but only if no comment on the end of the 'def' line.

stretch feature:

  • also translate markdown / latex code in the comment to a pretty display
@RGD2
Copy link
Author

RGD2 commented Nov 3, 2022

Nice benefit of this is, if you redefine a variable accidentally, then the 'pretty name' will straight away vanish from the display, which is likely to be noticed.

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

No branches or pull requests

1 participant