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 Tutor: multiline string representation of custom objects #5557

Closed
pdawyndt opened this issue May 28, 2024 · 1 comment
Closed

Python Tutor: multiline string representation of custom objects #5557

pdawyndt opened this issue May 28, 2024 · 1 comment
Assignees
Labels
feature New feature or request

Comments

@pdawyndt
Copy link
Contributor

pdawyndt commented May 28, 2024

Object of user-defined classes that implement a string representation function (str or repr) have this string representation used in the rendering of the object. However, newlines are replaced by spacrs and leading/trailing whitespace characters are stripped from this string representation. This gives an unnatural look to objects with a multiline string representation with leading/trailing whitespace. For example, an object with a string representation that looks like

  # . .
 # # # #
# # # # #
 . # # #
  . . #

is now rendered as

# . . # # # # # # # # # . # # # . . #

Example: https://dodona.be/nl/submissions/18102857/

Would be more natural to show the original (multiline) string representation for the object.

@pdawyndt pdawyndt added the feature New feature or request label May 28, 2024
@github-project-automation github-project-automation bot moved this to Unplanned in Roadmap May 28, 2024
@pdawyndt pdawyndt changed the title Multiline string representation of custom objects Python Tutor: multiline string representation of custom objects May 28, 2024
@pdawyndt
Copy link
Contributor Author

Use a monospace font for this representation, as proper alignment is often key with these string representations.

@jorg-vr jorg-vr self-assigned this Jun 18, 2024
@jorg-vr jorg-vr closed this as completed Jun 18, 2024
@github-project-automation github-project-automation bot moved this from Unplanned to Done in Roadmap Jun 18, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature New feature or request
Projects
Status: Done
Development

No branches or pull requests

2 participants