Set of Dictionary

Vibha Tripathi vibtrip at yahoo.com
Thu Jun 16 14:39:16 EDT 2005


Thanks for the responses! 

I tried using list - the real question now is how do I
remove duplicate dictionaries?

I will try things to work around it...suggestions are
welcome.

peace.

--- Konstantin Veretennicov <kveretennicov at gmail.com>
wrote:

> On 6/16/05, Vibha Tripathi <vibtrip at yahoo.com>
> wrote:
> > I need sets as sets in mathematics:
> 
> That's tough. First of all, mathematical sets can be
> infinite. It's
> just too much memory :)
> Software implementations can't fully match
> mathematical abstractions.
> 
> >    sets of any unique type of objects including
> those
> > of dictionaries, I should then be able to do:
> > a_set.__contains__(a_dictionary) and things like
> that.
> 
> Maybe you can use a list for that:
> 
> >>> d1 = {1: 2}
> >>> d2 = {3: 4}
> >>> s = [d1, d2]
> >>> {1: 2} in s
> True
> >>> {5: 6} in s
> False
> 
> > Can sets in Python 2.4.1, be reimplemented from
> > scratch to not have it work on top of dict?
> 
> Sure, why not?
> 
> - kv
> 


=======
"Things are only impossible until they are not."

__________________________________________________
Do You Yahoo!?
Tired of spam?  Yahoo! Mail has the best spam protection around 
http://mail.yahoo.com 



More information about the Python-list mailing list