Message360804
The idea behind PEP 519 was to alleviate str(path_obj) calls between the os/program interface. We can either make that as consistent as we can as we find places that still require the str(path_obj) idiom, or we can make users remember which ones do, and which ones don't, easily use a Path object.
In my opinion, having to remember is a very unpleasant and frustrating user experience.
Serhiy Storchaka:
----------------
> Path-like objects are now unintentionally accepted for many non-path
> things, like hostname in socket.sethostname() and username in
> os.initgroups(). I also think it was a mistake, and we should not
> make new mistakes.
There will always be ways for users to make mistakes when using API's. Whether they passed a Path path to os.sethostname() or a string path to os.sethostbyname(), it's still their bug, and linters/type-checkers exist to help catch those kinds of bugs.
Brett Canon:
-----------
> Environment variables are strings, period, so they should be specified
> as such;
Out of curiosity, any idea how often non-strings are used to set os.environ, and so need explicit conversion? |
|
Date |
User |
Action |
Args |
2020-01-27 21:26:46 | ethan.furman | set | recipients:
+ ethan.furman, brett.cannon, vstinner, serhiy.storchaka, Antony.Lee, eryksun |
2020-01-27 21:26:46 | ethan.furman | set | messageid: <1580160406.15.0.892278786256.issue39461@roundup.psfhosted.org> |
2020-01-27 21:26:46 | ethan.furman | link | issue39461 messages |
2020-01-27 21:26:45 | ethan.furman | create | |
|