[Python-ideas] shutil.symlink to allow non-race replacement of existing link targets

Serge Matveenko s at matveenko.ru
Tue May 14 03:37:57 EDT 2019


On Tue, May 14, 2019 at 4:34 AM Steven D'Aprano <steve at pearwood.info> wrote:
> You "see ... no obvious difference" between two functions that live in
> completely different modules?
>
> <skipped>
>
> The bottom line is that it is completely normal and not uncommon for
> functions to be distinguished by the namespace they are found in. It is
> both unreasonable and unnecessary to force objects in different
> namespaces to have unique names.

There is no need to explain basic things to me. Thank you very much indeed!

My point was that in case of `os.symlink` vs `shutil.symlink` it is
not obvious how they are different even taking into account their
namespaces.

In the case `os.remove` vs `list.remove` the difference is obvious as
namespaces clearly represent different subjects. On the other hand, it
is not that easy to guess the developer intent comparing `os` and
`shutil` subjects. Why there are two different implementations? Which
one should I use? While I don't need "force" functionality at the
moment is it ok to use the one from `os` package or I would need that
in the future? Is it worth just stick with the one from `shutil` and
forget that `os.symlink` exists at all?


More information about the Python-ideas mailing list