[Python-ideas] Working with Path objects: p-strings?
Greg Ewing
greg.ewing at canterbury.ac.nz
Sat Mar 26 19:13:25 EDT 2016
Chris Angelico wrote:
> There's b"..." vs u"...", which do represent entirely different
> objects,
That's true, but they're not entirely unrelated -- bytes
objects are the py3 version of what str was in py2.
Also, they're both pretty fundamental to the language,
and they're essentially pure representations of data, with
not much semantics attached.
Path objects, on the other hand, come with a pile of
semantics relating to a particular application area --
manipulation of the file system. Moreover, those
semantics vary depending on what operating system you're
running on. So it's hard so see them as being part of
the language the way str and bytes are.
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?
> plus f"..." which isn't even a literal at all, but more like
> a special syntax for an expression
It still evaluates to a str, though.
--
Greg
More information about the Python-ideas
mailing list