On Fri, Feb 11, 2022 at 07:01:12PM +0000, Paul Moore wrote:
> 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.
"Very confusing". Huh. Maybe they would be less confused if they would
look at the entire path expression, instead of just the ${b} envar in
isolation.
Real environment variables are not usually called "${a}", they have
names that reflect their meaning. And they typically have values which
are more meaningful than "d1/f1".
Real environment variables can be file names, or suffixes or prefixes,
or directiory components, but your example where ${a} combines a
directory component with a prefix, and ${b} combines a suffix with a
file name, is surely a terrible design. Who would do that?
No wonder you gave them single letter names, it would be awful to have
to come up with a descriptive name for doing this. Or a use-case.
But that's okay, people use terrible designs all the time. It is not our
job to protect them from themselves. If it was, Python wouldn't have
metaclasses, or classes, or functions, or variables, or code.
The conclusion you would like us to draw from this invented example is
that we should forego supporting envars in pathlib because of the
miniscule risk that somebody using a really shitty design with badly
thought-out envars might be confused by one of the envars in isolation.
I'm sorry Paul, but this sort of made-up, utterly artificial toy example
adds no benefit to the discussion, it just adds fear, uncertainty and
doubt to an extremely straight-forward feature request.
--
Steve
_______________________________________________
Python-ideas mailing list -- [email protected]
To unsubscribe send an email to [email protected]
https://mail.python.org/mailman3/lists/python-ideas.python.org/
Message archived at
https://mail.python.org/archives/list/[email protected]/message/O2XYTOLQG4A27P5QYAOVQDH5JUEFPFE3/
Code of Conduct: http://python.org/psf/codeofconduct/