On 7 May 2018 at 13:33, Nathaniel Smith <njs@pobox.com> wrote:
Spit-balling: how about __filepath__ as a
lazily-created-on-first-access pathlib.Path(__file__)?

Promoting os.path stuff to builtins just as pathlib is emerging as
TOOWTDI makes me a bit uncomfortable.

pathlib *isn't* TOOWTDI, since it takes almost 10 milliseconds to import it, and it introduces a higher level object-oriented abstraction that's genuinely distracting when you're using Python as a replacement for shell scripting.

While lazy imports could likely help with the import time problem (since 6.5 of those milliseconds are from importing fnmatch), I think there's also a legitimate argument for a two tier system here, where we say "If you can't handle your filesystem manipulation task with just open, dirname, abspath, and joinpath, then reach for the higher level pathlib abstraction".

Cheers,
Nick.

--
Nick Coghlan   |   ncoghlan@gmail.com   |   Brisbane, Australia