How to guard against bugs like this one?

Steven D'Aprano steven at REMOVE.THIS.cybersource.com.au
Wed Feb 3 05:52:42 CET 2010


On Tue, 02 Feb 2010 19:55:15 -0800, Carl Banks wrote:

> On Feb 2, 5:49 pm, Steven D'Aprano
> <ste... at REMOVE.THIS.cybersource.com.au> wrote:
>> On Tue, 02 Feb 2010 12:26:16 -0800, Carl Banks wrote:
>> > I did not propose obvious module names.  I said obvious names like
>> > email.py are bad; more descriptive names like send_email.py are
>> > better.
>>
>> But surely send_email.py doesn't just send email, it parses email and
>> receives email as well?
> 
> No, it doesn't.

Nevertheless, as a general principle, modules will tend to be multi-
purpose and/or generic. How would you rename the math or random modules 
to be less "obvious" and more "descriptive"?

And of course, the less obvious the name, the harder it becomes for 
people to find and use it. Which extreme would you rather?

import zip
import compress_and_decompress_files_to_zip_archives


I'm sympathetic to the position you're taking. It's not bad advice at 
all, but I think you're over-selling it as a complete solution to the 
problem of name clashes. I think it can only slightly alleviate the 
problem of name clashes, not eliminate it.


-- 
Steven



More information about the Python-list mailing list