Organizing Code - Packages

xkenneth xkenneth at gmail.com
Fri Sep 7 11:06:36 EDT 2007


All,

    I apologize if this is a commonly asked question, but I didn't
find anything that answered my question while searching.

So what I have right now is a few packages that contain some commonly
used functions and another package that contains all of my custom
error classes. I want these error classes available to me in all of
the other packages in my library. Currently to achieve this at the top
of every module file I have the line "from My.Library.Errors import
*", my problem with this is that it manages to import the Errors into
every scope that they are used. I'm still pretty new to Python, and my
approachs are probably very rooted in C/C++ (I've had the hardest time
getting over not being able to overload functions), but am I doing
this correctly?

   Also, are there any good tutorials/examples out there of how to
organize your python code into packges?

Thanks for all the help!

Regards,
Ken




More information about the Python-list mailing list