Code in __init__.py, is it bad form?

Michael Crute mcrute at gmail.com
Mon Feb 23 21:48:36 EST 2009


On Mon, Feb 23, 2009 at 9:41 PM, Benjamin Peterson <benjamin at python.org> wrote:
> Michael Crute <mcrute <at> gmail.com> writes:
>> On Mon, Feb 23, 2009 at 9:03 PM, Steve Holden <steve <at> holdenweb.com> wrote:
>> > No, it's absolutely fine. One common usage is to import symbols from
>> > sub-modules so that they are available from a simple import of the package.
>>
>> Yeah, I use it often for that I'm talking more about stuff like
>> utility functions, main methods, etc...
>
> There's no overarching Python doctrine forbidding you to do it. It has simply
> become a matter of taste. Personally, I tend to put utility functions in their
> own module (eg. util), but I do use __init__ for main methods and such.

Okay, so assuming I have decent judgment it sounds like I'm not doing
anything patently wrong. Thanks for the input.

-mike

-- 
________________________________
Michael E. Crute
http://mike.crute.org

God put me on this earth to accomplish a certain number of things.
Right now I am so far behind that I will never die. --Bill Watterson



More information about the Python-list mailing list