On Sat, 12 Feb 2022 at 16:02, Chris Angelico <ros...@gmail.com> wrote:
>
> On Sun, 13 Feb 2022 at 02:57, Eric V. Smith <e...@trueblade.com> wrote:
> > See Paul’s example, copied above. Maybe the code isn’t expecting it.
> >
>
> There wasn't an actual example, just a hypothetical one. I have never
> once seen something in real usage where you interpolate environment
> variables into a path, without expecting the environment variables to
> be paths.
>
> It's different with URLs, but pathlib doesn't handle URLs, it handles paths.

My example was not intended to illustrate that having slashes within
variables wasn't reasonable, but rather that concatenating a string to
a variable without an intervening slash *could* be confusing. But
equally it might not be:

backup = os.path.expandvars("${ORIGFILE}.bak")

The point I was trying to make is that thinking of expandvars as
acting on strings is straightforward, whereas thinking of the operands
as paths can lead to expectations that might be wrong. I'm arguing
that we should not link expandvars with paths, even though
historically it's part of os.path.

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/BDJ6WRBBACUFQIFIUHPE2M5VYAFAVBVF/
Code of Conduct: http://python.org/psf/codeofconduct/

Reply via email to