On Tue, Oct 06, 2020 at 09:30:06AM -0700, aleksiy123 wrote:
> Currently there are a few Protocols
> https://docs.python.org/3/library/typing.html#protocols defined in the
> typing module. One that I recently felt like was missing was a typing
> annotation for classes with a __str__() method defined. Seems like a fairly
> straightforward implementation.


Why do you care specifically about the `__str__` dunder? Calling str() 
is one of those protocols that should always succeed, whether the 
argument defines `__str__`, `__repr__`, or inherits from object.

Ignoring the possibility of bugs or deliberate raising, I can't think of 
any object that doesn't support the str() protocol. Have I missed 
anything?



-- 
Steve
_______________________________________________
Python-ideas mailing list -- python-ideas@python.org
To unsubscribe send an email to python-ideas-le...@python.org
https://mail.python.org/mailman3/lists/python-ideas.python.org/
Message archived at 
https://mail.python.org/archives/list/python-ideas@python.org/message/JQHO2EQ562RLV22ARWTLTRHZ6X7W4HPW/
Code of Conduct: http://python.org/psf/codeofconduct/

Reply via email to