You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
os.path (and related utilities from the os module) should be replaced by pathlib.Path and its higher-level API where performance is not a concern.
Notes
As far as I know there are not issue with performance related to this. In other words, there is no place where os.path is used that using Path/its API instead would incur noticeable performance costs.
In cases where that may be the case, it's almost always the case the os.path is being called on a path string that is usually using os.path.join anyways.
In some cases, this can be extracted from loops (examples?).
I'm unsure if performance is still a concern here; the bottom line is that Path is easier to support than str + os.path.
This can be enabled as a ruff linter ruleset (PTH), which is currently disabled.
The text was updated successfully, but these errors were encountered:
os.path
(and related utilities from theos
module) should be replaced bypathlib.Path
and its higher-level API where performance is not a concern.Notes
os.path
is used that usingPath
/its API instead would incur noticeable performance costs.os.path
is being called on a path string that is usually usingos.path.join
anyways.Path
is easier to support thanstr
+os.path
.ruff
linter ruleset (PTH
), which is currently disabled.The text was updated successfully, but these errors were encountered: