On 5 Oct 2005 08:23:53 GMT, Antoon Pardon [EMAIL PROTECTED] wrote:
Op 2005-10-05, Tom Anderson schreef [EMAIL PROTECTED]:
On Tue, 4 Oct 2005, Robert Kern wrote:
Antoon Pardon wrote:
class Tree:
def __lt__(self, term):
return set(self.iteritems()) set(term.iteritems())
Op 2005-10-05, Steve Holden schreef [EMAIL PROTECTED]:
Antoon Pardon wrote:
Op 2005-10-05, Steve Holden schreef [EMAIL PROTECTED]:
[...]
Anyway, I have searched the source of the test for all testing
with regards to and after some browsing back and fore it seems
it all boils down to the
Op 2005-10-05, Tom Anderson schreef [EMAIL PROTECTED]:
On Tue, 4 Oct 2005, Robert Kern wrote:
Antoon Pardon wrote:
class Tree:
def __lt__(self, term):
return set(self.iteritems()) set(term.iteritems())
def __eq__(self, term):
return set(self.iteritems()) ==
Antoon Pardon [EMAIL PROTECTED] writes:
But that is contradicted by the unittest. If you have a unittest for
comparing dictionaries, that means comparing dictionaries has a
testable characteristic and thus is further defined.
No, I don't think so. The unittest makes sure that a particular
Antoon Pardon wrote:
Op 2005-10-05, Tom Anderson schreef [EMAIL PROTECTED]:
On Tue, 4 Oct 2005, Robert Kern wrote:
Antoon Pardon wrote:
class Tree:
def __lt__(self, term):
return set(self.iteritems()) set(term.iteritems())
def __eq__(self, term):
return
Op 2005-10-05, Paul Rubin schreef http:
Antoon Pardon [EMAIL PROTECTED] writes:
But that is contradicted by the unittest. If you have a unittest for
comparing dictionaries, that means comparing dictionaries has a
testable characteristic and thus is further defined.
No, I don't think so. The
Steve Holden [EMAIL PROTECTED] writes:
I can't help wondering, though, under what conditions it actually
makes sense to compare two dictionaries for anything other than
equality.
You might want to sort a bunch of dictionaries to bring the equal ones
together.
--
Antoon Pardon [EMAIL PROTECTED] writes:
My tree class is almost finished, but one unittest still fails,
is this a failing of my class (as a replacement for a dictionary)
or is this a non-required characteristic of dictionaries?
If it were me, I'd treat the language reference manual as
Op 2005-10-05, Steve Holden schreef [EMAIL PROTECTED]:
Antoon Pardon wrote:
I have been searching some more and finally stumbled on this:
http://docs.python.org/ref/comparisons.html
Mappings (dictionaries) compare equal if and only if their sorted
(key, value) lists compare equal.
Antoon Pardon wrote:
Op 2005-10-05, Steve Holden schreef [EMAIL PROTECTED]:
[...]
Anyway, I have searched the source of the test for all testing
with regards to and after some browsing back and fore it seems
it all boils down to the following two tests.
self.assert_(not {} {})
On Tue, 4 Oct 2005, Robert Kern wrote:
Tom Anderson wrote:
On Tue, 4 Oct 2005, Robert Kern wrote:
Antoon Pardon wrote:
Anyone a reference?
The function dict_compare in dictobject.c .
Well there's a really helpful answer.
Well, *I* thought it was.
And indeed it was. I'm sorry i was so
I'm writing a Tree class, which should behave a lot like a dictionary.
In order to test this, I took the unittest from the source distribution
for dictionaries and used it to test against my Tree class.
Things are working out rather well, but I stumbled on a problem.
this unittest tries to test
Antoon Pardon wrote:
I'm writing a Tree class, which should behave a lot like a dictionary.
In order to test this, I took the unittest from the source distribution
for dictionaries and used it to test against my Tree class.
Things are working out rather well, but I stumbled on a problem.
On Tue, 4 Oct 2005, Robert Kern wrote:
Antoon Pardon wrote:
class Tree:
def __lt__(self, term):
return set(self.iteritems()) set(term.iteritems())
def __eq__(self, term):
return set(self.iteritems()) == set(term.iteritems())
Would this be a correct definition of
Tom Anderson wrote:
On Tue, 4 Oct 2005, Robert Kern wrote:
Antoon Pardon wrote:
class Tree:
def __lt__(self, term):
return set(self.iteritems()) set(term.iteritems())
def __eq__(self, term):
return set(self.iteritems()) == set(term.iteritems())
Would this be a correct
15 matches
Mail list logo