[issue37486] pathlib.Path('.').parent is itself rather than parent

2019-07-02 Thread Brett Cannon
Brett Cannon added the comment: Would it be worth to set 'parent' to None in this instance? Might break code but would also be potentially less surprising. -- nosy: +brett.cannon ___ Python tracker

[issue37486] pathlib.Path('.').parent is itself rather than parent

2019-07-02 Thread adrien.pierre.horgn...@gmail.com
adrien.pierre.horgn...@gmail.com added the comment: T-T Sorry. It didn't feel intuitive but I should have read the doc... -- ___ Python tracker ___ __

[issue37486] pathlib.Path('.').parent is itself rather than parent

2019-07-02 Thread Antoine Pitrou
Antoine Pitrou added the comment: This is by design. The "parent" attribute is a *lexical operation*. If you want to walk the actual filesystem, first call resolve(). It's even documented: https://docs.python.org/3/library/pathlib.html#pathlib.PurePath.parent -- resolution: -> not

[issue37486] pathlib.Path('.').parent is itself rather than parent

2019-07-02 Thread Christian Heimes
Change by Christian Heimes : -- nosy: +pitrou versions: +Python 3.8, Python 3.9 ___ Python tracker ___ ___ Python-bugs-list mailing

[issue37486] pathlib.Path('.').parent is itself rather than parent

2019-07-02 Thread adrien.pierre.horgn...@gmail.com
New submission from adrien.pierre.horgn...@gmail.com : Tested with CPython 3.7.3 ``` from pathlib import Path p = Path('.') assert p == p.parent # should fail but it does not ``` I expect Path('.').parent to be Path('..') I searched issues and did not find any similar issue but maybe I did