[issue19776] Provide expanduser() on Path objects

Antoine Pietri report at bugs.python.org
Mon Apr 28 05:42:48 CEST 2014


Antoine Pietri added the comment:

> I think that `absolute` method should call `expanduser` and `expandvars` (do you plan to include it?) automatically. This should be optional (via default arguments: `expanduser=True, expandvars=True`.

I think it shouldn't. (Or shouldn't be set to True by default anyway).
absolute() method resolves symlinks, and it would make no sense to expand tildes and vars, which are purely a "shell syntax".

. and .. are real things in the filesystem, ~ is just a notation commonly used (since it's in the SCL spec), but it's not *part* of the path, that's why you can totally have a valid ~ file.

Making absolute() expand tildes would be illogic, unintuitive and unpythonic.

(+1 for the .expanduser() patch though, I went here after searching for this feature in the docs).

----------
nosy: +seirl

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue19776>
_______________________________________


More information about the Python-bugs-list mailing list