[Python-Dev] proposed os.fspath() change (original) (raw)
Ethan Furman ethan at stoneleaf.us
Wed Jun 15 16:00:01 EDT 2016
- Previous message (by thread): [Python-Dev] proposed os.fspath() change
- Next message (by thread): [Python-Dev] proposed os.fspath() change
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
On 06/15/2016 12:24 PM, Koos Zevenhoven wrote:
On Wed, Jun 15, 2016 at 10:15 PM, Brett Cannon wrote:
ABCs like os.PathLike can override subclasshook so that registration isn't required (see https://hg.python.org/cpython/file/default/Lib/os.py#l1136). So registration is definitely good to do to be explicit that you're trying to meet an ABC, but it isn't strictly required.
And the other question could be turned into whether to make str and bytes also PathLike in subclasshook.
No, for two reasons.
- most str's and bytes' are not paths;
- PathLike indicates a rich-path object, which str's and bytes' are not.
--
Ethan
- Previous message (by thread): [Python-Dev] proposed os.fspath() change
- Next message (by thread): [Python-Dev] proposed os.fspath() change
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]