-
Notifications
You must be signed in to change notification settings - Fork 1.3k
Add __repr__ to custom PS1 class #25568
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
base: main
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -75,6 +75,9 @@ def __str__(self): | |
|
|
||
| return result | ||
|
|
||
| def __repr__(self): | ||
| return "<Custom PS1 for VS Code Python Shell Integration>" | ||
|
Comment on lines
+78
to
+79
|
||
|
|
||
|
|
||
| if sys.platform != "win32" and (not is_wsl): | ||
| sys.ps1 = PS1() | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The
__repr__method should follow Python conventions by including the class name. A typical pattern for__repr__when the object cannot be recreated from the string is<ClassName: description>. Consider changing this to something like<PS1: Custom PS1 for VS Code Python Shell Integration>or<pythonrc.PS1 object at {hex(id(self))}>to make it clearer what type of object this represents.