Skip to content

Remove __str__ methods #8475

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

Merged
merged 2 commits into from
Aug 3, 2022
Merged

Conversation

sobolevn
Copy link
Member

@sobolevn sobolevn commented Aug 3, 2022

I continue to remove methods that exist on object.

There are couple of extras:

  • There are __str__ methods with different signatures
  • There are @abstractmethod __str__ methods
  • There are __format__ methods with regular named, non __fmt, arguments (I kept them for now)

@github-actions

This comment has been minimized.

@sobolevn
Copy link
Member Author

sobolevn commented Aug 3, 2022

Ok, I am wrong about __format__. It is required: https://github.com/python/mypy/blob/d2063d260ad3096df78867abf53aa247d67b401e/mypy/checkstrformat.py#L367

If a type has its own __format__ specs, then it must define __format__ according to mypy.

@sobolevn sobolevn changed the title Remove __str__ and __format__ methods Remove __str__ methods Aug 3, 2022
@github-actions
Copy link
Contributor

github-actions bot commented Aug 3, 2022

According to mypy_primer, this change has no effect on the checked open source code. 🤖🎉

@srittau srittau merged commit 38c4a1e into python:master Aug 3, 2022
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

Successfully merging this pull request may close these issues.

2 participants