On 2012-10-12 20:42, Antoine Pitrou wrote:
On Fri, 12 Oct 2012 12:23:46 -0700 Ethan Furman
wrote: Which is why I would like to see Path based on str, despite Guido's misgivings. (Yes, I know I'm probably tilting at windmills here...)
If Path is string based we get backwards compatibility with all the os and third-party tools that expect and use strings; this would allow a gentle migration to using them, as opposed to the all-or-nothing if Path is a completely new type.
It is not all-or-nothing since you can just call str() and it will work fine with both strings and paths.
The disadvantage of using str is that it will also convert non-path objects to strings, possibly changing the result of the call:
os.path.isdir(1) Traceback (most recent call last): File "
", line 1, in <module> os.path.isdir(1) TypeError: 'int' does not support the buffer interface os.path.isdir(str(1)) False