File system path annotations
Roel Schroeven
roel at roelschroeven.net
Mon Jun 19 10:04:16 EDT 2023
Op 19/06/2023 om 11:44 schreef Peter Slížik:
> Thank you, Roel. You've answered all my questions.
>
> > [PEP 519]: ...as that can be represented with typing.Union[str,
> bytes, os.PathLike] easily enough and the hope is users
> > will slowly gravitate to path objects only.
>
> I read a lot on Python and, frankly, I don't see this happening.
> People on the Internet keep using /str/ as their path representation
> choice. Presumably, programmers don't feel the need to bother with a
> complex solution if the simplest option works just fine.
I agree, I don't see that happening either. I often find myself using
str for paths: often simple filenames are all that's needed, and then I
don't see much point in importing pathlib and wrapping the filenames in
Path() constructors. I do tend to switch to path objects when I start
needing to do operations on the paths, though.
--
"Your scientists were so preoccupied with whether they could, they didn't
stop to think if they should"
-- Dr. Ian Malcolm
More information about the Python-list
mailing list