A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://mail.python.org/pipermail/python-dev/2016-May/144585.html below:

[Python-Dev] File system path PEP, part 2

[Python-Dev] File system path PEP, part 2Chris Angelico rosuav at gmail.com
Fri May 13 07:28:46 EDT 2016
On Fri, May 13, 2016 at 9:00 PM, Steven D'Aprano <steve at pearwood.info> wrote:
> Cons:
> (3) Polymorphic code that truly doesn't care whether it gets bytes or
> str will have a slightly less convenient way of getting it, namely by
> calling __fspath__() itself, instead of os.fspath().

I don't like this; it goes against the general principle that dunders
are for defining, not calling. Generally, a given dunder method has
approximately one call site, eg __reduce__ in pickle.py, and everyone
else defines it. (You might call super's dunder in the definition of
your own, but that's still defining it, not calling it.) Having an
official statement that it's appropriate to call a dunder confuses
this. So this isn't a "slightly less convenient way", it's a bad way
(IMO), and this is a very strong con.

ChrisA
More information about the Python-Dev mailing list

RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4