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

Sven R. Kunze srkunze at mail.de
Tue Mar 29 04:44:54 EDT 2016


On 27.03.2016 00:51, Koos Zevenhoven wrote:
> On Sun, Mar 27, 2016 at 1:13 AM, Greg Ewing 
> <greg.ewing at canterbury.ac.nz <mailto:greg.ewing at canterbury.ac.nz>> wrote:
>
>     [...]
>     This feels like a slippery slope to me. If we include
>     special syntax for pathnames, why shouldn't we have it
>     for dates and times? Regular expressions? URLs? JSON
>     data? SQL queries? XML data? Where do we draw the line?
>

Just because you want to draw a line does not necessarily mean, we want 
to draw one. ;)

I don't think we (as the Python community) can allow ourselves to stand 
still. We need to have tools that are simple and available. If YAML is 
the new standard for everything, Python should move. If $ before 
variable names are the new standard (I hope they never will again), 
Python should move.

I understand that there are preservers who don't want anything to 
change. So, compromises will be necessary.

> OT:
>
> To be honest, I do think it feels like URL:s are becoming (or have 
> become) just as important as paths, and that pathlib.Path should in 
> the future work with URLs just like it now works with windows and 
> posix paths. The difference between "http://domain.xyz/" and "C:\\" is 
> not huge. I also think there should be a Python type (stdlib or 
> builtin), which handles JSON objects nicer than dicts do and has its 
> own literal

That even occurred to me after we talked about the p-string (mainly 
because I am working in this field, so I basically need both file paths 
and URIs).


I agree with the URI/IRI idea. It feels natural and sometimes it is 
necessary to extract specific parts from an URL according to RFC 3986 or 
3987. So, +1 from me.


Just for the record: "Path" might not be the most correct wording. There 
is a "file://" scheme which identifies locally located files. So, paths 
are basically a subset of URLs speaking functionality-wise. Thus, a 
better/more generic name would be "URL", "URI", "Link" or the like in 
order to avoid confusing of later generations. However, I think I could 
live with Path.


Another thought: requesting URLs. Basically the same as 
p'/etc/hosts'.write_text(secret). It's really important to have a dead 
simple library which is able to work with URLs. So, if I could do:

p'https://mysite.com/{page}'.get()

that'll be awesome.

Best,
Sven
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-ideas/attachments/20160329/369bf378/attachment-0001.html>


More information about the Python-ideas mailing list