keyword in package name.

Steve Holden steve at holdenweb.com
Sun Oct 19 12:44:57 EDT 2008


Abhishek Mishra wrote:
> On Oct 19, 12:11 pm, Tino Wildenhain <t... at wildenhain.de> wrote:
>> Abhishek Mishra wrote:
>>> Hello Everyone,
>>> I have the habit of using domain names (of either the application or
>>> company) in reverse in package names.
>>> for e.g. com.spam.app1
>> While this seemed a good idea for java, I don't think it makes
>> sense for python - the reason: in python you have an import
>> mechanism, where in java you just have namespaces.
>>
>> Therefore you can always avoid namespace clashes at import time.
>>
> Hi,
> 
> Thanks for your reply on a Sunday!
> 
> Here's my 2 cents on why I prefer this mechanism -
> 
> I would like not to worry about namespace clashes at import time.
> Using a toplevel package which isolates your namespace from all
> others, is a good idea in my opinion.
> This could be a product name (like MoinMoin in MoinMoin), company name
> (like google in google app engine - which is just one short of
> com.google btw), or your DNS.
> Therefore I use a domain name lots of times. (I admit that I picked up
> this habit from programming a lot in java).
> 
> Although it looks like in this case I would have to use just the
> project name.
> 
That will work fine until one of your top-level domains is also a
package or module on some other element of sys.path.

I can see why the convenience of a familiar naming convention might be
appealing, but you shouldn't try to stretch it beyond its natural
boundaries.

regards
 Steve
-- 
Steve Holden        +1 571 484 6266   +1 800 494 3119
Holden Web LLC              http://www.holdenweb.com/




More information about the Python-list mailing list