@@ -1195,14 +1195,15 @@ Below is a table mapping various :mod:`os` functions to their corresponding
1195
1195
1196
1196
.. note ::
1197
1197
1198
- Although :func: `os.path.relpath ` and :meth: `PurePath.relative_to ` have some
1199
- overlapping use-cases, their semantics differ enough to warrant not
1200
- considering them equivalent.
1198
+ Not all pairs of functions/methods below are equivalent. Some of them,
1199
+ despite having some overlapping use-cases, have different semantics. They
1200
+ include :func: `os.path.abspath ` and :meth: `Path.resolve `,
1201
+ :func: `os.path.relpath ` and :meth: `PurePath.relative_to `.
1201
1202
1202
1203
==================================== ==============================
1203
- os and os.path pathlib
1204
+ :mod: ` os ` and :mod: ` os.path ` :mod: ` pathlib `
1204
1205
==================================== ==============================
1205
- :func: `os.path.abspath ` :meth: `Path.resolve `
1206
+ :func: `os.path.abspath ` :meth: `Path.resolve ` [ # ]_
1206
1207
:func: `os.chmod ` :meth: `Path.chmod `
1207
1208
:func: `os.mkdir ` :meth: `Path.mkdir `
1208
1209
:func: `os.makedirs ` :meth: `Path.mkdir `
@@ -1221,6 +1222,7 @@ os and os.path pathlib
1221
1222
:func: `os.link ` :meth: `Path.link_to `
1222
1223
:func: `os.symlink ` :meth: `Path.symlink_to `
1223
1224
:func: `os.readlink ` :meth: `Path.readlink `
1225
+ :func: `os.path.relpath ` :meth: `Path.relative_to ` [# ]_
1224
1226
:func: `os.stat ` :meth: `Path.stat `,
1225
1227
:meth: `Path.owner `,
1226
1228
:meth: `Path.group `
@@ -1231,3 +1233,8 @@ os and os.path pathlib
1231
1233
:func: `os.path.samefile ` :meth: `Path.samefile `
1232
1234
:func: `os.path.splitext ` :data: `PurePath.suffix `
1233
1235
==================================== ==============================
1236
+
1237
+ .. rubric :: Footnotes
1238
+
1239
+ .. [# ] :func: `os.path.abspath ` does not resolve symbolic links while :meth: `Path.resolve ` does.
1240
+ .. [# ] :meth: `Path.relative_to ` requires ``self `` to be the subpath of the argument, but :func: `os.path.relpath ` does not.
0 commit comments