[issue29425] File-altering aspects of pathlib should return new pathlib objects
Serhiy Storchaka
report at bugs.python.org
Tue Feb 7 04:32:32 EST 2017
Serhiy Storchaka added the comment:
Path.rename() is simple wrapper around os.rename() and returns the result of os.rename(). If os.rename() became returning something useful, this change will made impossible to return it from Path.rename().
Why not create destination Path object explicitly?
bar_var = pathlib.PosixPath('bar')
foo_var = pathlib.PosixPath('foo')
bar_var.rename(foo_var)
Note, that in 3.6 you can also write
os.rename(bar_var, foo_var)
----------
nosy: +pitrou, serhiy.storchaka
versions: +Python 3.7 -Python 3.6
_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue29425>
_______________________________________
More information about the Python-bugs-list
mailing list