[Tutor] Converting from a single module to a package
g.nius.ck at gmail.com
Fri Aug 5 21:53:27 CEST 2011
To make a package, you make a folder named what you want to name the
package, for example: virus_toolkit. Then you make a file in it called
__init__.py. This is what you import if you import the virus_toolkit. You
usually put documentation and general functions in this I believe (I'm not
100% sure on package etiquette.) Then you put various modules inside the
folder, such as brute force, worms, and Trojan_horse. Then you can do from
virus_toolkit import worms, and such, or if you want to unleash a full out
attack and import them all, do from virus_toolkit import *.
On Fri, Aug 5, 2011 at 3:25 PM, Tim Johnson <tim at johnsons-web.com> wrote:
> I'm been coding in python now for close to 10 years. one of the
> modules that I have composed for re-use has gotten pretty big:
> It is implemented as
> import tlib as std
> I am thinking about 'downsizing' this module and breaking it up into
> smaller components, thus a package. And I would like to do this
> without a lot of code revisions.
> I would welcome references to URLs on this topic.
> tim at johnsons-web dot com or akwebsoft dot com
> Tutor maillist - Tutor at python.org
> To unsubscribe or change subscription options:
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the Tutor