[Python-Dev] Defining a path protocol (original) (raw)
Ethan Furman ethan at stoneleaf.us
Fri Apr 8 12:36:03 EDT 2016
- Previous message (by thread): [Python-Dev] Defining a path protocol (was: When should pathlib stop being provisional?)
- Next message (by thread): [Python-Dev] Defining a path protocol
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
On 04/08/2016 09:04 AM, Chris Barker wrote:
On Fri, Apr 8, 2016 at 2:50 AM, Nick Coghlan wrote:
Method, as long as there's a helper function somewhere what has the helper function got to do with whether it's a method or attribute (would we call a property an attribute here?)
Built-in? (name is dependent on #1 if we add one) os.fspath (alongside os.fsencode and os.fsdecode) [...] this is only going to be used by the stdlib and other path-using libraries, not user code -- is that that hard to call obj.fspath() ?
- user code may call it
- folks who write libraries are still users ;)
- using __dunder__s directly is usually poor form.
I thought the whole point off all this is that not any old string can be a path! (whereas any int can be an index). Unless we go with Chris A's suggestion that this be a more generic lossless string protocol, rather than just for paths.
That does seem to be a valid point against str.fspath.
--
Ethan
- Previous message (by thread): [Python-Dev] Defining a path protocol (was: When should pathlib stop being provisional?)
- Next message (by thread): [Python-Dev] Defining a path protocol
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]