[Python-ideas] __dir__ in which folder is this py file
Chris Angelico
rosuav at gmail.com
Sun May 6 22:35:22 EDT 2018
On Mon, May 7, 2018 at 12:13 PM, Nick Coghlan <ncoghlan at gmail.com> wrote:
> So I have a different suggestion: perhaps it might make sense to propose
> promoting a key handful of path manipulation operations to the status of
> being builtins?
>
> Specifically, the ones I'd have in mind would be:
>
> - dirname (aka os.path.dirname)
> - joinpath (aka os.path.join)
These two are the basics of path manipulation. +1 for promoting to
builtins, unless pathlib becomes core (which I suspect isn't
happening).
> - abspath (aka os.path.abspath)
Only +0.5 on this, as it has to do file system operations. It may be
worthwhile, instead, to promote os.path.normpath, which (like the
others) is purely processing the string form of the path. It'll return
the same value regardless of the file system.
But yes, I'd much rather see path manipulation based on __file__ and
builtins rather than injecting yet another module-level attribute
that's derived from what we already have.
ChrisA
More information about the Python-ideas
mailing list