[Python-ideas] Dunder method to make object str-like
Nikolaus at rath.org
Mon Apr 11 17:09:01 EDT 2016
On Apr 11 2016, Ethan Furman <ethan-gcWI5d7PMXnvaiG9KC9N7Q at public.gmane.org> wrote:
> On 04/11/2016 07:43 AM, Nikolaus Rath wrote:
>> On Apr 10 2016, Ethan Furman wrote:
>>> By having a well-defined protocol and helper function we not only make
>>> our own lives easier but we also make the lives of third-party
>>> libraries and experimenters easier.
>> To me this sounds like catering to a hypothetical audience that may want
>> to do hypothetical things. If you start with the above, and people
>> complain that their favorite non-pathlib path library is not supported
>> by the stdlib, you can still add a protocol. But if you add a protocol
>> right away, you're stuck with the complexity for a very long time even
>> if almost no one actually uses it.
> The part of "make our own lives easier" is not a hypothetical
My assumption was that "own" refers to core developers here, while..
> Making my own library (antipathy) work seamlessly with pathlib and
> DirEntry is not hypothetical.
..here you seem to be wearing your third-party maintainer hat :-).
As far as I can see, implementing a protocol instead of adding a few
isinstance checks is more likely to make the life of a CPython developer
harder than easier.
GPG encrypted emails preferred. Key id: 0xD113FCAC3C4E599F
Fingerprint: ED31 791B 2C5C 1613 AF38 8B8A D113 FCAC 3C4E 599F
»Time flies like an arrow, fruit flies like a Banana.«
More information about the Python-ideas