[Python-ideas] Working with Path objects: p-strings?

Wes Turner wes.turner at gmail.com
Wed Mar 30 04:56:01 EDT 2016


On Mar 30, 2016 3:47 AM, "Sven R. Kunze" <srkunze at mail.de> wrote:
>
> On 29.03.2016 23:57, Paul Moore wrote:
>>
>> On 29 March 2016 at 22:00, Sven R. Kunze <srkunze at mail.de> wrote:
>>>
>>> However, something that I cannot leave uncommented is "suboptimal
>>> representation for paths". What would your optimal representation for
paths
>>> look like? I cannot believe that the current representation is so bad
and
>>> has been for so long and nobody, really nobody, has anything done about
it.
>>
>> Well, pathlib.Path :-)
>>
>> The point here is that C's char* representation is a serialisation of
>> a path object, just like 123 is a serialisation of an integer object.
>> We don't object to having to convert user input to a string if we need
>> to, why object to having to convert it to a Path if appropriate?
>
>
> I think there is a misunderstanding here. Let me quote myself:
>
> '''I think most "practicality beats purity" folks don't want that either.
They are just bloody lazy. They actually want the benefits of both, the
pure datastructure with its convenience methods and the dirty str-like
thing with its convenience methods.'''
>
> The desire is not "str vs. Path"; its "Path + str". (at least from what I
can tell)

so, like str but without +, %, .format ?

class pathstr(str):
  __add__
  __mod__
  format

python3: pathstr(str)?
python2: pathstr(unicode)?

>
>
> Best,
> Sven
>
> _______________________________________________
> Python-ideas mailing list
> Python-ideas at python.org
> https://mail.python.org/mailman/listinfo/python-ideas
> Code of Conduct: http://python.org/psf/codeofconduct/
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-ideas/attachments/20160330/da85a5f0/attachment.html>


More information about the Python-ideas mailing list