Re: [Tutor] class initialization with a lot of parameters

2009-11-11 Thread C.T. Matsumoto
Hello Alan, I see a new way to look at this design so I'm pretty excited to refactor the code. I've also been looking for an example to use 'overloading operators' as the Learn Python book calls it. I think its time to close this discussion because the parameters question has gotten much advice,

Re: [Tutor] class initialization with a lot of parameters

2009-11-11 Thread Emile van Sebille
On 11/11/2009 10:19 AM Alan Gauld said... what we actually do in Python is if number1.__eq__(number2): In other words we call the special method __eq__() of number1 passing in number2. So == is actually a method of the object on the left hand side. ... and sometimes the right hand side. Co

Re: [Tutor] class initialization with a lot of parameters

2009-11-11 Thread Alan Gauld
"C.T. Matsumoto" wrote The Table object you described I find more complicated if each table stands on its own it is decoupled from its compare partner. I suppose a function that pairs the tables, feeding a Table object to its partner Table.compare method. Kind of. Think about something s

Re: [Tutor] class initialization with a lot of parameters

2009-11-11 Thread C.T. Matsumoto
Great, I do see my objects working as functions so my OOP understanding needs development. I've got to roll this around to come up with a design which will be more OOP centered and change the code accordingly. To start I could move CompareTableList into DB. This will make a list of tables that nee

Re: [Tutor] class initialization with a lot of parameters

2009-11-11 Thread Alan Gauld
"C.T. Matsumoto" wrote First I've got a db class class DB(object): """ This does all the database handling. """ That's fine. Then I've got a class to filter a list of potential tables to be compared. These tables need to be tested. OK, Could that be a method of your database? cl

Re: [Tutor] class initialization with a lot of parameters

2009-11-10 Thread C.T. Matsumoto
Thanks for the ideas, I see I still don't have the hang of this context thing! I still haven't provided enough context. So here goes again, to show the entire chain. This might change the discussion to be about design practice but it will give overview of how I'm using the class in question. Firs

Re: [Tutor] class initialization with a lot of parameters

2009-11-10 Thread Dave Angel
Luke Paireepinart wrote: On Tue, Nov 10, 2009 at 1:21 PM, Dave Angel wrote: (Removing out of sequence history) DaveA instances of that class. Better than using tuples. makes sense to make a class to hold the seven parameters, and pass two If you're passing two sets of 7 parameters to the

Re: [Tutor] class initialization with a lot of parameters

2009-11-10 Thread Luke Paireepinart
On Tue, Nov 10, 2009 at 1:21 PM, Dave Angel wrote: > (Removing out of sequence history) > > DaveA > > instances of that class. Better than using tuples. > makes sense to make a class to hold the seven parameters, and pass two > If you're passing two sets of 7 parameters to the same function, it

Re: [Tutor] class initialization with a lot of parameters

2009-11-10 Thread Alan Gauld
"C.T. Matsumoto" wrote This list provides defines 2 tables that need to be paired and then compared. So two instances of a TestTable object maybe? reference_table_name reference_dburi reference_rows test_table_name test_dburi test_rows keys Looks like two TestTable objects and a set of

Re: [Tutor] class initialization with a lot of parameters

2009-11-10 Thread Dave Angel
(Removing out of sequence history) DaveA instances of that class. Better than using tuples. makes sense to make a class to hold the seven parameters, and pass two If you're passing two sets of 7 parameters to the same function, it probably ___ Tuto

Re: [Tutor] class initialization with a lot of parameters

2009-11-10 Thread Lie Ryan
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, iter

Re: [Tutor] class initialization with a lot of parameters

2009-11-10 Thread C.T. Matsumoto
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 sever

Re: [Tutor] class initialization with a lot of parameters

2009-11-09 Thread Dave Angel
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

Re: [Tutor] class initialization with a lot of parameters

2009-11-09 Thread Alan Gauld
"C.T. Matsumoto" 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 y

[Tutor] class initialization with a lot of parameters

2009-11-09 Thread C.T. Matsumoto
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 assi