This reply is also to Alan's suggestion to provide more context. The situation concerns databases, where in one schema table I've got a 'compare list'. This list provides defines 2 tables that need to be paired and then compared. Before any comparing happens I 'filter' the compare list doing several validation tests. Once all the test succeed (exists, with the necessary things to compare) I'm left with the information describing the 2 tables:
reference_table_name reference_dburi reference_rows test_table_name test_dburi test_rows keys It is with this information that I wanted to create a class object. Filling a 'master list' of 'CompareItem' objects. Cheers, T On Tue, Nov 10, 2009 at 1:05 AM, Dave Angel <[email protected]> wrote: > C.T. Matsumoto wrote: > >> 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. >> >> <snip> >> >> >> > Don't do it. Putting the parameters into a tuple only makes sense if > they're somehow related to each other. And if all the parameters are in the > tuple, all you've done is to add another parenthesis pair around the > argument list. > > Now, if the parameters are related to each other (like the coordinates of > an n-dimensional point), then it makes sense to group them. As Alan said, a > class can be good for that. So can tuples, but only if there's some > connection, or if they already were being treated as a tuple. > > Note that if you want to declare your parameters as a tuple, you can use > the * notation in the parameter list. And if you want to pass the arguments > as a tuple, you can use the * notation in the argument list. Or both. But > you need to have a reason, other than "too many parameters." > > > DaveA > > -- Todd Matsumoto
_______________________________________________ Tutor maillist - [email protected] To unsubscribe or change subscription options: http://mail.python.org/mailman/listinfo/tutor
