Code in __init__.py, is it bad form?

alex23 wuwei23 at gmail.com
Tue Feb 24 03:43:15 CET 2009


On Feb 24, 12:21 pm, Michael Crute <mcr... at gmail.com> wrote:
> Yeah, I use it often for that I'm talking more about stuff like
> utility functions, main methods, etc...

Personally, I use it only for those tasks related to 'initialising'
the package, a la the importing of various modules for convenience
sake (as mentioned by Steve).

I don't expect a class to define its method within its __init__, so
I'd find it unusual for a package to be defining any kind of
functionality within its __init__.py. I wouldn't _not_ use your code,
but I might eye it warily... :)



More information about the Python-list mailing list