[Python-ideas] New PEP proposal -- Pathlib Module Should Contain All File Operations

Stephen J. Turnbull turnbull.stephen.fw at u.tsukuba.ac.jp
Sat Mar 17 02:18:27 EDT 2018


Joonas Liik writes:

 > then it might be an acceptable compromise to have yet another...

"There should be one-- and preferably only one -- obvious way to do it."

The obvious way is to use the existing stdlib modules.  So....

 > package that just imports os, pathlib, shutil etc and re-exports
 > all relevant functions.

Anybody wanting this can easily do a better job than the stdlib ever
can do -- by writing a package including all the modules they
frequently use and only re-exporting those names that they use,
perhaps with shorter or personally mnemonic aliases (Windows vs. Unix
nomenclature for many shell utilities, for example -- but watch those
builtins like "dir"!)

Of course, this is horrible programming practice, making for burdens
on reviewers and maintainers.  I see the convenience for writing
one-off scripts and perhaps a personal library, but I don't see it as
a core function of the language and its standard library.  So, -1 in
the stdlib, and +0 for a base module on PyPI that demonstrates the
principle and individual users could modify to personal taste.

Steve


More information about the Python-ideas mailing list