![](https://secure.gravatar.com/avatar/d67ab5d94c2fed8ab6b727b62dc1b213.jpg?s=120&d=mm&r=g)
On Fri, Apr 8, 2016 at 4:42 AM, M.-A. Lemburg <mal@egenix.com> wrote:
On 07.04.2016 18:46, Chris Angelico wrote:
On Fri, Apr 8, 2016 at 2:27 AM, M.-A. Lemburg <mal@egenix.com> wrote:
Not necessarily. In fact, a string.String ABC could have only a single method: .__str__() defined.
That wouldn't be very useful; object.__str__ exists and is functional, so EVERY object would count as a string.
No, only those objects that register with the ABC would be considered string-like, not all objects implementing the .__str__() method. In regular Python, only str() objects would register with strings.String.
Oh, gotcha. In that case, it would still be pretty much the same as the __fspath__ proposal, except that instead of creating a dunder method (to implement a protocol), you register with an ABC. ChrisA