"C.T. Matsumoto" <[email protected]> wrote

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?

There are no rules as such. Some of the Tkinter classes for excample
take a lot of arguments.

But you can usually simplify it by using default values and named parameters.
Also can any of the input values be grouped together into an object?
OOP means programming with objects, and that includes passing
whole objects aropund as arguments.

class Foo(object):
   def __init__(self, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8):

But with only a generic example to guide us we can only offer limited help.


--
Alan Gauld
Author of the Learn to Program web site
http://www.alan-g.me.uk/

_______________________________________________
Tutor maillist  -  [email protected]
To unsubscribe or change subscription options:
http://mail.python.org/mailman/listinfo/tutor

Reply via email to