Skip to content

Conversation

@barneygale
Copy link
Contributor

@barneygale barneygale commented Feb 14, 2022

Following an idea from Alex Waygood:

Here's my two cents, as a non-expert when it comes to pathlib:

I'm not really sure why is_mount() exists on WindowsPath objects, given that it unconditionally raises NotImplementedError on WindowsPath objects -- that seems very strange to me. It seems to me like it should probably be a method on the PosixPath class rather than on the Path class.

The other methods that raise NotImplementedError don't seem as egregious, because none of them unconditionally raise NotImplementedError. We could debate whether some of them would raise different errors in an ideal world, but changing them now might have implications for backwards compatibility, and it doesn't seem like a major issue to me.

I suppose it might also be worth considering moving owner() and group() to PosixPath. In practice, these unconditionally raise NotImplementedError on Windows, since the pwd and grp modules are not available on Windows. So, in an ideal world, they probably wouldn't exist on the common base class.

Again, though, that needs to be weighed against backwards-compatibility considerations.

This makes a lot of sense to me, and lets us fix three two inappropriate uses of NotImplementedError.

https://bugs.python.org/issue46733

@barneygale barneygale changed the title bpo-46733: move pathlib.Path.owner(), group() and is_mount() to PosixPath bpo-46733: move pathlib.Path.owner() and group() to PosixPath Feb 21, 2022
@barneygale barneygale marked this pull request as draft March 3, 2022 01:33
@barneygale barneygale closed this Dec 24, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants