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
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
[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
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
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
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
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
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
> 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
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."
>
>
>
> __
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
11 matches
Mail list logo