Cross-reference 'import' in a class hierarchy

Ben Finney bignose-hates-spam at and-zip-does-too.com.au
Tue Apr 8 00:52:13 EDT 2003


On Tue, 08 Apr 2003 04:02:07 GMT, Jeremy Bowers wrote:
> It is interesting that all the Python programs I've seen that are
> broken up into files at all (and not just 100+KB hunks of text) are
> plopped into one directory.  

What are your thoughts on Mailman?  It, at least, is a complex
application broken into subdirectories by functional area.

Sadly it has executables that use an 'import paths' hack to get around
this irritating Python limitation.  Fine for executables that are placed
in the path, but lousy for within-the-module unit tests.

> I'd PEP it but given that nobody else is uncomfortable polluting this
> part of the namespace it seems the odds of it going anywhere are slim.

Given the responses I've received in this newsgroup and elsewhere, I'd
say you are certainly not alone with being uncomfortable with namespace
pollution as an 'import' hack.  Please feel free to PEP it.

> In particular, I have found this helpful in putting all the unit tests
> in separate directories named "tests" under the things they are
> actually testing

Which makes a mockery of the elegance of 'if __name__ == "__main__"' for
unit testing.

-- 
 \       "[On the Internet,] power and control will shift to those who |
  `\       are actually contributing something useful rather than just |
_o__)                                 having lunch."  -- Douglas Adams |
http://bignose.squidly.org/ 9CFE12B0 791A4267 887F520C B7AC2E51 BD41714B




More information about the Python-list mailing list