[issue37130] pathlib.with_name() doesn't like unnamed files.

2019-06-07 Thread Terry J. Reedy
Terry J. Reedy added the comment: Welcome to Python. If you end up proposing a change to code or doc, this will end up being the right place. A change to a documented behavior be called an 'enhancement' and only applied to the next version. A doc change will likely be backported. ---

[issue37130] pathlib.with_name() doesn't like unnamed files.

2019-06-05 Thread N.P. Khelili
N.P. Khelili added the comment: The idea in my last post was quite bad, setting name to None breaks a lot of functions that expect name to be a string. Path('.').parent and Path('..').parent both return '.'. Even if it is not stupid (regarding them as special dirs pointing to somewhere else b

[issue37130] pathlib.with_name() doesn't like unnamed files.

2019-06-04 Thread N.P. Khelili
N.P. Khelili added the comment: in the definition of the name property https://github.com/python/cpython/blob/9ab2fb1c68a75115da92d51b8c40b74f60f88561/Lib/pathlib.py#L792 : if len(parts) == (1 if (self._drv or self._root) else 0): return '' could also become if self.parent == self

[issue37130] pathlib.with_name() doesn't like unnamed files.

2019-06-03 Thread Jeffrey Kintscher
Change by Jeffrey Kintscher : -- nosy: +Jeffrey.Kintscher ___ Python tracker ___ ___ Python-bugs-list mailing list Unsubscribe: htt

[issue37130] pathlib.with_name() doesn't like unnamed files.

2019-06-03 Thread Brett Cannon
Change by Brett Cannon : -- stage: -> test needed ___ Python tracker ___ ___ Python-bugs-list mailing list Unsubscribe: https://ma

[issue37130] pathlib.with_name() doesn't like unnamed files.

2019-06-03 Thread Brett Cannon
Brett Cannon added the comment: The inconsistency is a bit weird. Looking at https://github.com/python/cpython/blob/master/Lib/pathlib.py#L825 the question is why is self.name not being set for '.' but it is for '..'. I suspect there's special-casing for '.' somewhere that sets self.name to

[issue37130] pathlib.with_name() doesn't like unnamed files.

2019-06-01 Thread N.P. Khelili
New submission from N.P. Khelili : Hi guys! I'm new to python and working on my first real project with it I'm sorry if it's not the right place for posting this. I noticed that that pathlib.with_name() method does not accept to give a name to a path that does not already have one. It se