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

Random832 random832 at fastmail.com
Tue Mar 29 14:59:02 EDT 2016


On Tue, Mar 29, 2016, at 14:51, Brett Cannon wrote:
> OK, so if all paths can be represented as strings, why don't we just make
> `pathlib.Path` subclass `str`? Well, as I said earlier, not all strings
> are
> paths. You can't concatenate a string representing a path with some other
> random string and expect to get back a string that still represents a
> valid
> string

I assume you mean a valid path.

You can't add an int to a float and expect to get an integer back,
either. If you're adding it to a random string you're clearly not using
it in a path context, and the type of the result won't be Path anyway.


More information about the Python-ideas mailing list