On Sun, May 6, 2018 at 8:47 PM, Nick Coghlan firstname.lastname@example.org wrote:
On 7 May 2018 at 13:33, Nathaniel Smith email@example.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.
Hmm, the feedback I've heard from at least some folks teaching intro-python-for-scientists is like, "pathlib is so great for scripting that it justifies upgrading to python 3".
data_path = __filepath__.parent / "foo.txt"
more distracting than
data_path = joinpath(dirname(__file__), "foo.txt")
? And the former gives you far more power: the full Path interface, not just 2-3 common operations.
Import times are certainly a consideration, but I'm uncomfortable with jumping straight to adding things to builtins based on current import times, without at least exploring options for speeding that up...