On Fri, 11 Feb 2022 at 16:37, Christopher Barker <python...@gmail.com> wrote:
>
> On Fri, Feb 11, 2022 at 12:28 AM Serhiy Storchaka <storch...@gmail.com> wrote:
>>
>> expandvars() does not operate on paths, it operates on strings and
>> bytestrings. There is nothing path-specific here. Expanding environment
>> variables consists of three distinct steps:
>
> sure -- but it does live in os.paths now, the docs talk about paths, and it 
> is useful for paths -- so it seems a fine idea to have that functionality in 
> pathlib.

One way that tying it to paths is bad is that it ignores the path
structure. If environment variable a is "d1/f1" and b is "d2/f2" then
"${a}x${b}" is "d1/f1xd2/f2", which could be very confusing to someone
who sees the value of b and expects the result to be a file in a
directory called d2. Yes, I know that the documentation could make
this clear (the docs in os.path don't, BTW) and I know that it's no
different than the os.path version, but adding an expandvars method to
pathlib feels like throwing good money after bad...

Let's leave it where it is and keep the status quo, or fix it
*properly* and put it somewhere more logical like shlex. Personally I
don't use it that often, so I'm fine with just leaving it alone.

Paul
_______________________________________________
Python-ideas mailing list -- python-ideas@python.org
To unsubscribe send an email to python-ideas-le...@python.org
https://mail.python.org/mailman3/lists/python-ideas.python.org/
Message archived at 
https://mail.python.org/archives/list/python-ideas@python.org/message/2XSYXAFLMMVGJDYJYRM2CDZO2WV5YDX6/
Code of Conduct: http://python.org/psf/codeofconduct/

Reply via email to