[Python-Dev] File system path PEP, part 2 (original) (raw)
Chris Angelico rosuav at gmail.com
Fri May 13 07:28:46 EDT 2016
- Previous message (by thread): [Python-Dev] File system path PEP, part 2
- Next message (by thread): [Python-Dev] File system path PEP, part 2
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
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
- Previous message (by thread): [Python-Dev] File system path PEP, part 2
- Next message (by thread): [Python-Dev] File system path PEP, part 2
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]