On Mar 20, 2020, at 19:32, Christopher Barker <python...@gmail.com> wrote: > > It’s a bit ironic: if you have a nifty idea for Python, you are often told to > try it out on your own. And if you expect it to maybe make its way into > Python, you’d want to use a dunder... > > But then, dunders are reserved for the standard library. It’s a pickle.
When third-party libs end up in the stdlib, they usually change. Sometimes there are just small bikeshedding changes, like simplejson/json or statistics/stats, sometimes the whole thing gets redesigned, like attr.s/dataclasses or flufl.enum/enum. If you’re designing something that you hope will one day get standardized, maybe it’s not such a bad thing that you’re forced to think of how the migration is going to go for your early adopter users, and make them think about it too. And if the stdlib version might change the semantics of the protocol in any way, which is more disruptive to users: the stdlib json module doesn’t respect your _tojson methods because it wants __json__, or the stdlib json module sort of respects your __json__ methods but gets it “wrong” in some important cases because it uses the same name but with changed semantics? And then, if you used _tojson, you can add the stdlib’s __json__ and the same module works as the backport of the 3.10 stdlib to older versions and as the more-featureful third-party module some people still need. _______________________________________________ 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/IT3SYBHNJCJXQUMAKGIQQ2OTFIRNMSSG/ Code of Conduct: http://python.org/psf/codeofconduct/