Author neologix
Recipients Arfrever, Claudiu.Popa, antoine.pietri, fletom, neologix, pitrou, rominf, serhiy.storchaka, vajrasky, vstinner
Date 2014-07-23.19:44:19
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <>
> There is a question. What should pathlib's expanduser() do in case
> when user directory can't be determined (or user does not exist)?
> Perhaps unlike to os.path.expanduser() it should raise an exception
> (as in many other pathlib's methods).

Let's see what POSIX says:

If the system does not recognize the login name, the results are undefined.

Helpful, isn't it ;-)

Behaving like os.path.expanduser() would have the advantage of consistency (which is in turn consistent with Unix shells), OTOH, it seems wrong to just return the unexpanded form: for example, if someone calls expanduser('~apache') and there's apache user, returning '~apache' could be dangerous if there was an '~apache' folder in the CWD.

So I think it would be better to raise an exception.
Date User Action Args
2014-07-23 19:44:20neologixsetrecipients: + neologix, pitrou, vstinner, Arfrever, Claudiu.Popa, serhiy.storchaka, vajrasky, antoine.pietri, fletom, rominf
2014-07-23 19:44:20neologixsetmessageid: <>
2014-07-23 19:44:20neologixlinkissue19776 messages
2014-07-23 19:44:19neologixcreate