namespace collisions

elbertlev at hotmail.com elbertlev at hotmail.com
Thu Feb 17 23:47:59 EST 2005


John Lenton wrote:
> On Thu, Feb 17, 2005 at 06:20:36PM +0000, Will McGugan wrote:
> > Hi,
> >
> > I'm accumulating a number of small functions, which I have sensibly
put
> > in a single file called 'util.py'. But it occurs to me that with
such a
> > generic name it could cause problems with other modules not written
by
> > myself. Whats the best way of handling this? If I put it in a
common
> > location in my Python path, should I call it willsutil.py?
>
>    local.util
>
> is probably a convention worth starting :)
>
> or you could go with
>
>    WilMcGugan.util
>
> but ThatGetsOldFast.
>
>
> --
> John Lenton (john at grulic.org.ar) -- Random fortune:
> All my friends are getting married,
> Yes, they're all growing old,
> They're all staying home on the weekend,
> They're all doing what they're told.

I call modules like x_utils.py, where prefix x is assigned to a
particular pakage. In this case import statements look like:

import Company.repotrtools.e_excel as e_excel

or

from Company.repotrtools.e_excel import e_writer, e_reader

generally this are classes, not functions.

Newer had namespace collisions (yet :)




More information about the Python-list mailing list