[Python-Dev] Improvements for Pathlib

Ionel Cristian Mărieș contact at ionelmc.ro
Sat Nov 8 20:02:23 CET 2014


On Saturday, November 8, 2014, Xavier Morel <python-dev at masklinn.net> wrote:

>
>
> Why would pathlib need to provide this when tempfile already does?
>
>   with tempfile.NamedTemporaryFile(prefix='') as f:
>       tmp = pathlib.Path(f.name)
>
>   with tempfile.TemporaryDirectoryDirectory(prefix='') as d:
>       tmp = pathlib.Path(d.name)
>
> For the same reason pathlib provides path manipulation functionality while
os.path already does: a cohesive and more convenient api. In other words, I
want to have less calls and variables around (less room for errors, less
visual bloat), and this is such a common pattern it's worth supporting it
in pathlib.



-- 

Thanks,
-- Ionel M.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-dev/attachments/20141108/30593dfd/attachment.html>


More information about the Python-Dev mailing list