[Tutor] What not to put in __init__()

Tony Cappellini cappy2112 at gmail.com
Wed Oct 4 04:08:37 CEST 2006


I've just inherited a lot of python code to maintain.

The __init__ functions in many of the classes are very long- some over 100
lines.

I like to keep functions/methods short & readable at a glance, if possible.

1. Is it good methodology to move some code from _init__ to it's own method
within the class?


 For example there are many for loops with several levles of nested if
statements within them.
I'd like to move each of these for/if chunks to distinct methods, so to
simplify the look of __init__, without modifying how it works.


thanks
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mail.python.org/pipermail/tutor/attachments/20061003/60bb06a2/attachment.htm 


More information about the Tutor mailing list