[Python-Dev] Pathlib enhancements - acceptable inputs and outputs for __fspath__ and os.fspath()
victor.stinner at gmail.com
Wed Apr 13 17:37:33 EDT 2016
Le mercredi 13 avril 2016, Brett Cannon <brett at python.org> a écrit :
> All of this is demonstrated in
> https://gist.github.com/brettcannon/b3719f54715787d54a206bc011869aa1 by
> the various possibilities. In the end it's not a corner case because the
> definition of __fspath__ will be such that there's no ambiguity in what
> os.fspath() will accept and what __fspath__ can return and the code will be
> written to conform to what the PEP dictates (IOW I'm aware that this needs
> to be considered in the implementation :) .
I'm not a big fan of a flag parameter to change the return type of a
function. Usually, two functions are preferred. In the os module we have
getcwd/getcwdb for example. I don't know if it's a good example
Do you know other examples of Python functions taking a (flag) parameter to
change the result type?
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the Python-Dev