[Python-Dev] Convention on functions that shadow existing stdlib functions (original) (raw)
R. David Murray rdmurray at bitdance.com
Wed Jul 27 17:11:10 CEST 2011
- Previous message: [Python-Dev] Convention on functions that shadow existing stdlib functions
- Next message: [Python-Dev] Convention on functions that shadow existing stdlib functions
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
On Wed, 27 Jul 2011 16:58:53 +0300, Eli Bendersky <eliben at gmail.com> wrote:
R. David Murray wrote: > 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.
Well, that would seem to be a matter of opinion. I see your point, but I'm not sure that I agree. But see below.
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.
What I mean is that if the test code always did:
import support
[...]
support.unlink('testtempfile')
then there would be no confusion when someone grepped the code for 'unlink' or was reading the code without having noticed the import. That is, give the functions a unique name by using the 'support' name space explicitly, rather than by renaming them within the module.
-- R. David Murray http://www.bitdance.com
- Previous message: [Python-Dev] Convention on functions that shadow existing stdlib functions
- Next message: [Python-Dev] Convention on functions that shadow existing stdlib functions
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]