[Tutor] class initialization with a lot of parameters
C.T. Matsumoto
c.t.matsumoto at gmail.com
Mon Nov 9 13:33:33 CET 2009
Hello All,
I'm making a class and the parameters I'm feeding the class is getting quite
large. I'm up
to 8 now. Is there any rules of thumb for classes with a lot of parameters?
I was thinking
to put the parameters into a tuple and then in the __init__ of the class,
iterate over the tuple
and assign attributes.
Right now my class basically looks like this:
class Foo(object):
def __init__(self, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8):
...
Cheers
T
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/tutor/attachments/20091109/95782f40/attachment.htm>
More information about the Tutor
mailing list