Re: [Tutor] Best way to define comparison

2008-05-17 Thread Tiago Katcipis
ops im sorry..i didnt noticed that reply just replyed to you..i thought it would go to the list. Thanks for the help best regards On Sat, May 17, 2008 at 8:36 PM, Kent Johnson <[EMAIL PROTECTED]> wrote: > On Sat, May 17, 2008 at 7:04 PM, Tiago Katcipis <[EMAIL PROTECTED]> > wrote: > > ive been

Re: [Tutor] Best way to define comparison

2008-05-17 Thread Kent Johnson
On Sat, May 17, 2008 at 7:04 PM, Tiago Katcipis <[EMAIL PROTECTED]> wrote: > ive been reading and really seens to be better to use cmp... i will not have > to write a method to every single operator. But when python compare > objects...like in Sets or Lists...to check for membership etc, it uses cm

Re: [Tutor] Best way to define comparison

2008-05-17 Thread Kent Johnson
On Sat, May 17, 2008 at 2:18 PM, Tiago Katcipis <[EMAIL PROTECTED]> wrote: > Im writing a class on python and i want to implement the == and != operators > on it. I have read about __cmp__ and about __eq__ for == and __ne__ for ! =. > My question is... who is the better to use? Use __cmp__() if it

Re: [Tutor] Best way to define comparison

2008-05-17 Thread bob gailer
Tiago Katcipis wrote: Im writing a class on python and i want to implement the == and != operators on it. I have read about __cmp__ and about __eq__ for == and __ne__ for ! =. My question is... who is the better to use? and if there is no better what are the advantages and disvantages of them.

[Tutor] Best way to define comparison

2008-05-17 Thread Tiago Katcipis
Im writing a class on python and i want to implement the == and != operators on it. I have read about __cmp__ and about __eq__ for == and __ne__ for ! =. My question is... who is the better to use? and if there is no better what are the advantages and disvantages of them. Some articles talk about u

Re: [Tutor] Dictionaries or Numpy?

2008-05-17 Thread Adam Clarridge
On 5/16/08, John Fouhy <[EMAIL PROTECTED]> wrote: > > On 17/05/2008, Adam Clarridge <[EMAIL PROTECTED]> wrote: > > I'm fairly new to Python, and I am not sure whether it would be faster > > for me to use a Dictionary data type to represent the board > > (advantages: indices can be strings or tup

Re: [Tutor] Iterate through dictionary values and remove item

2008-05-17 Thread Ricardo Araoz
Kent Johnson wrote: On Thu, May 15, 2008 at 12:58 PM, GTXY20 <[EMAIL PROTECTED]> wrote: I suspect that I need to get a better handle on the difference between items() and iteritems() and what situations would call for them respectively. items() returns a list, iteritems() returns an iterator.