[Python-Dev] Convention on functions that shadow existing stdlib functions
Eli Bendersky
eliben at gmail.com
Sun Jul 24 05:35:56 CEST 2011
Some background: I'm working (on and off) on issue 11015 - documenting
the public functions in test.support
Some of the functions in test.support (for example unlink, rmtree)
simply shadow existing & popular stdlib functions, with the aim of
swallowing the exceptions these may throw. This is confusing, IMHO.
For example, grepping 'unlink' on Lib/test/test_*.py files doesn't say
much about which unlink is being used.
A couple of options to handle this are:
1. Remove these functions altogether, trying to use existing
constructs (such as the ignore_errors parameter in rmtree).
2. Adapt a naming convention for such functions, for instance
rmtree_silent and unlink_silent (or a similar convention, if one
exists)
Opinions?
Eli
More information about the Python-Dev
mailing list