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.
Yep, it's a typo.
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.
You're assuming it's always clear. If that was always true then no one would ever find a bug in their code when porting to Python 3. We can all assume we won't screw up, but the fact bugs exist shows that's not true.