-
Notifications
You must be signed in to change notification settings - Fork 16
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
Format multiline local repr values better #92
Comments
I think we do want quotes around strings; it will make them look like strings, and also make the locals copy-paste-able. In the grander scheme of things, I think we'll want to provide type-specific reprs eventually. This also makes me wonder if there's a way to allow users to provide their own type-specific reprs. This could be useful, e.g., if a team wants to adopt a template for annotations. What do you think? |
Good, I agree on quotes. Jupyter has a pluggable display mechanism, for example, an object which implements We could introduce a similar |
* Format multiline locals by indenting all lines uniformly #92 * Add test for multiline reprs This also includes a fix to test_assert_stmt_surrounding_lines. In 484d14a#diff-a48123d72539171bb8301baf301217bbR522 I made an erroneous fix that modified the expected number of lines of context instead of modifying the expected line related to the assertion. I really don't like the brittleness of this aspect of our test suite.
Is your feature request related to a problem? Please describe.
If a local variable has a value whose
repr
is multiple lines, the first line is indented by a tab plus the variable name, but the rest of the lines are flush with the left margin of the terminal.This is particularly annoying for tabular data, where the first line, usually column names, is offset from the data rows.
For example:
Describe the solution you'd like
Multiline output reprs should be indented uniformly.
Describe alternatives you've considered
Could also special case things like
pandas.DataFrame
but doing it for anything whichrepr
s to something with newlines seems better.Additional context
Additionally, values are currently rendered with
str
, notrepr
, which means strings don't get quotes and so don't look like strings, and there's no space around the equals sign separating the name and value.I'm not sure whether we want strings to have quotes or not, what do you think @thejunglejane?
The text was updated successfully, but these errors were encountered: