PurePath.__truediv__ and __rtruediv__ raise a TypeError when passed something which is not an instance of string or PurePath. This prevents creating any sort of compatible class that doesn't inherit from the previously mentioned types.
Using your above example, my use case is returning an instance of Spam instead of PurePath from the division operation. The Spam class would have extra properties and methods for dealing with a substructure of our file system that can exist in different places, so being able to use a normal Path to locate it later with the division operation would be useful. (I know I could have a method that would do that, but I personally think reading the division left to right is clearer.)
The current implementation makes this impossible and I found raising a TypeError to be inconsistent with how Python handles operator overloading in the standard library.
Note: these values reflect the state of the issue at the time it was migrated and might not reflect the current state.
Show more details
The text was updated successfully, but these errors were encountered: