[Python-Dev] Convention on functions that shadow existing stdlib functions

Eli Bendersky eliben at gmail.com
Wed Jul 27 15:58:53 CEST 2011


> > 2. Some functions like unlink and rmtree are obviously redundant, and
> shadow
> > frequently used Python stdlib functions, so I would either kill them
> > completely or at least rename them appropriately.
>
> But they aren't redundant, since the test.support versions ignore
> errors.
>

As I mentioned elsewhere, it's not good practice to have two functions with
the same name doing something slightly different, in different modules in
the code-base.


>
> Perhaps what we could do is move the documentation for test.support to
> the devguide, and then vet the test suite so that unlink and friends
> are always called as 'support.unlink', etc.
>
>
Moving the documentation to the devguide is a good compromise between not
documenting them at all and placing the documentation in a user-visible
location.

What do you mean by vetting the test suite so that unlink is always taken
from test.support? I suppose some tests would specifically want the original
unlink's functionality. In fact, at least a few tests use os.unlink
exlicitly.

Eli
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-dev/attachments/20110727/342f28a4/attachment.html>


More information about the Python-Dev mailing list