__init__ patterns

Tim jtim.arnold at gmail.com
Thu Aug 30 09:01:26 EDT 2018


I saw a thread on reddit/python where just about everyone said they never put code in their __init__ files.

Here's a stackoverflow thread saying the same thing.
https://stackoverflow.com/questions/1944569/how-do-i-write-good-correct-package-init-py-files

That's new to me. I like to put functions in there that other modules within the module need. 
Thought that was good practice DRY and so forth. And I never do 'from whatever import *' 
Ever.

The reddit people said they put all their stuff into different modules and leave init empty.

What do you do?  I like my pattern but I'm willing to learn.

thanks,
--Tim



More information about the Python-list mailing list