Developing Techniques (and naming conventions)

Jeroen Ruigrok van der Werven asmodai at in-nomine.org
Sun Feb 24 15:21:16 EST 2008


-On [20080224 20:01], Adekoba (adekoba at gmail.com) wrote:
>I don't think moving food.py's code to __init__.py would work out to
>well, because then how would I run the script?

import food

Which in turn has something like this in food/__init__.py:

from food.cheese import gouda
from food.ham import parma

__all__ = ['gouda', 'parma']

and in turn in your script you can now use food.gouda and food.parma.

Unless I totally misunderstood what you are trying to achieve.

-- 
Jeroen Ruigrok van der Werven <asmodai(-at-)in-nomine.org> / asmodai
イェルーン ラウフロック ヴァン デル ウェルヴェン
http://www.in-nomine.org/ | http://www.rangaku.org/
We have met the enemy and they are ours...



More information about the Python-list mailing list