[Python-ideas] pathlib suggestion

Antoine Pitrou solipsis at pitrou.net
Tue May 20 17:25:18 CEST 2014


On Tue, 20 May 2014 10:51:22 +0200
Thomas Heller <theller at ctypes.org> wrote:
> Python 3.4's pathlib uses str(path) to get the full pathname
> as string.
> 
> I'd like to suggest adding a property which allows to access
> the full pathname.  IMO this should make it easier to understand
> the code or make if possible to search for it in sources.
> 
> I'm unsure about the name this property should get; maybe .fullpath
> or something like that.  I'm also unsure whether there should be
> separate properties to get the full pathname as string or bytes object.

.strpath perhaps?
(also .bytespath if desired)

It was once proposed as "filesystem path" protocol where classes
purporting to represent filesystem paths could define a e.g.
__strpath__ method returning the string representation of the path.  I
can only find the following allusions on python-ideas:
https://mail.python.org/pipermail/python-ideas/2012-October/016912.html
https://mail.python.org/pipermail/python-ideas/2012-October/016974.html

Regards

Antoine.




More information about the Python-ideas mailing list