[Python-ideas] `to_file()` method for strings

Koos Zevenhoven k7hoven at gmail.com
Thu Mar 24 17:41:37 EDT 2016


On Thu, Mar 24, 2016 at 11:22 PM, Alexander Belopolsky <
alexander.belopolsky at gmail.com> wrote:

>
> On Thu, Mar 24, 2016 at 5:06 PM, Koos Zevenhoven <k7hoven at gmail.com>
> wrote:
>
>> Then, somewhat less often, I need to give a str as an argument to
>> something. I then need an additional str(...) around the Path object.
>> That just feels stupid and makes me start wishing Path was a subclass of
>> str, and/or that Path was a builtin. ... Has this been discussed?
>>
>
> Yes, right in the PEP 428 where pathlib was proposed. [1]
>
> [1]: https://www.python.org/dev/peps/pep-0428/#id29
>

Thanks. The pep indeed mentions that str (or other builtins like tuple) are
not subclassed in pathlib, but couldn't find the explanation why. Well, it
would add all kinds of attributes, many of which will just be confusing and
not useful for paths.

 - Koos
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-ideas/attachments/20160324/35e774af/attachment.html>


More information about the Python-ideas mailing list