[Python-ideas] Better stdlib support for Path objects

Ed Kellett edk141 at gmail.com
Tue Oct 7 16:33:53 CEST 2014


On 7 October 2014 14:47, Barry Warsaw <barry at python.org> wrote:
> On Oct 07, 2014, at 02:45 PM, Ed Kellett wrote:
>
>>On 7 October 2014 14:37, Barry Warsaw <barry at python.org> wrote:
>>> What would __strpath__ do that __str__ wouldn't do?  Or do you think it's
>>> better to explicitly disallow str-like objects that aren't path objects?
>>
>>What is a str-like object? A lot of objects are acceptable to str();
>>most of them aren't "str-like" in any reasonable sense of the term
>>(e.g. function, int), and probably shouldn't be acceptable as paths.
>
> Sorry, str-able is probably a better term to use in the above.
>

Yeah - but whatever the term, I think being able to str() something is
too weak a predicate for using it as a path. If there were a way for
an object to declare itself str-like in the sense that Paths are,
that'd be much more reasonable, imv.


More information about the Python-ideas mailing list