[Python-ideas] Working with Path objects: p-strings?

Sven R. Kunze srkunze at mail.de
Wed Mar 30 11:32:16 EDT 2016


On 30.03.2016 16:55, Koos Zevenhoven wrote:
> The trick is, again, that the path is often in a variable coming from
> user input etc. and you don't (want to) deal with whether it is
> relative or absolute. This also still has a slash before relative
> paths too.
>
> Another thing is that, while / looks very nice, it makes you have to
> use parentheses when you want to directly call a method on the path:
>
>      (somedir / relative_file_path).method()
>
> We have been making examples with
> /many/'path'/'objects'/joined_together. But how often do people really
> join more than two paths at once?
>
> Sometimes, in interactive sessions, I have wished for this to work:
>
>      somedir(relative_file_path).method()
>
> ...which is kind of stupid ;)

This seems all to speak for p-strings. :)

Best,
Sven


More information about the Python-ideas mailing list