[Python-ideas] Better stdlib support for Path objects

Antoine Pitrou solipsis at pitrou.net
Mon Oct 6 19:58:13 CEST 2014


On Mon, 6 Oct 2014 13:47:14 -0400
Barry Warsaw <barry at python.org> wrote:
> 
> One simple solution would be to sprinkle str() calls in various stdlib
> methods, but I'm not sure if that would fail miserably in the face of bytes
> paths (if the original stdlib API even accepts bytes paths).  The suggestion
> in the issue is to add a "path protocol" and the referenced article suggests
> .strpath and .bytespath.  OTOH, isn't str() and bytes() enough?

str() works on anything (including enums and distutils compilers), so
it's pretty bad IMO.

Regards

Antoine.




More information about the Python-ideas mailing list