Re: [offtopic] Re: Set of Dictionary

2005-06-26 Thread Brian van den Broek
James Dennett said unto the world upon 26/06/2005 03:51: > Steven D'Aprano wrote: > > >>On Thu, 16 Jun 2005 21:21:50 +0300, Konstantin Veretennicov wrote: >> >> >> >>>On 6/16/05, Vibha Tripathi <[EMAIL PROTECTED]> wrote: >>> >>> I need sets as sets in mathematics: >>> >>>That's tough. First o

[offtopic] Re: Set of Dictionary

2005-06-26 Thread James Dennett
Steven D'Aprano wrote: > On Thu, 16 Jun 2005 21:21:50 +0300, Konstantin Veretennicov wrote: > > >>On 6/16/05, Vibha Tripathi <[EMAIL PROTECTED]> 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 :) >>S

Re: Set of Dictionary

2005-06-18 Thread Raymond Hettinger
[Vibha] > I know sets have been implemented using dictionary but > I absolutely need to have a set of dictionaries...any > ideas how to do that? Yes. Create a dictionary subclass that is hashable. Be sure not to mutate it after using it in a set. >>> class FrozenDict(dict): def __hash__(s

Re: Set of Dictionary

2005-06-17 Thread Oren Tirosh
See the frozendict recipe: http://aspn.activestate.com/ASPN/Cookbook/Python/Recipe/414283 It was written exactly for this purpose: a dictionary that can be a member in a set. Oren -- http://mail.python.org/mailman/listinfo/python-list

Re: Set of Dictionary

2005-06-16 Thread Steven D'Aprano
On Thu, 16 Jun 2005 21:21:50 +0300, Konstantin Veretennicov wrote: > On 6/16/05, Vibha Tripathi <[EMAIL PROTECTED]> 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 full

Re: Set of Dictionary

2005-06-16 Thread Vibha Tripathi
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 <[EMAIL PROTECTED]> wrote: > On 6/16/05, Vibha Tripathi <[EMAIL PROTECTED]> > wrote

Re: Set of Dictionary

2005-06-16 Thread Konstantin Veretennicov
On 6/16/05, Vibha Tripathi <[EMAIL PROTECTED]> 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 inc

Re: Set of Dictionary

2005-06-16 Thread Vibha Tripathi
I need sets as sets in mathematics: 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. Can sets in Python 2.4.1, be reimplemented from scratch to not have it work on top of dict? Peace. Vibha

Re: Set of Dictionary

2005-06-16 Thread Piet van Oostrum
> Vibha Tripathi <[EMAIL PROTECTED]> (VT) wrote: >VT> Hi Folks, >VT> I know sets have been implemented using dictionary but >VT> I absolutely need to have a set of dictionaries...any >VT> ideas how to do that? A set cannot contain duplicates. What happens when one of the dictionaries in the s

Re: Set of Dictionary

2005-06-16 Thread Scott David Daniels
Vibha Tripathi wrote: > Hi Folks, > > I know sets have been implemented using dictionary but > I absolutely need to have a set of dictionaries...any > ideas how to do that? > > Peace. > Vibha > > "Things are only impossible until they are not." > > > > __

Re: Set of Dictionary

2005-06-16 Thread Konstantin Veretennicov
On 6/16/05, Vibha Tripathi <[EMAIL PROTECTED]> wrote: > Hi Folks, > > I know sets have been implemented using dictionary but > I absolutely need to have a set of dictionaries... While you can't have a set of mutable objects (even dictionaries :)), you can have a set of immutable snapshots of thos