-
Notifications
You must be signed in to change notification settings - Fork 2k
os-path-commonprefix (RUF071): update documentation #24028
Copy link
Copy link
Closed
Labels
documentationImprovements or additions to documentationImprovements or additions to documentation
Description
RUF071 recommends using os.path.commonpath over os.path.commonprefix. However, that is not always desirable, and sometimes even incorrect. The documentation should cover the differences in semantics as well as cases where RUF071 should be ignored.
This rule's recommendation is confusing for those using
os.path.commonprefixwith non-path strings (which I think is perfectly legitimate):>> commonprefix(["123", "124"]) '12' >> commonpath(["123", "124"]) ''I am not sure of the status of a
string.commonprefixmethod in Python 3.15, but I think ruff's wording should be more carefully consider use cases such the one above.
Originally posted by @bersbersbers in #22981
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
documentationImprovements or additions to documentationImprovements or additions to documentation