On Saturday, November 8, 2014, Xavier Morel <[email protected]> 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.
_______________________________________________ Python-Dev mailing list [email protected] https://mail.python.org/mailman/listinfo/python-dev Unsubscribe: https://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com
