[Python-ideas] Identity dicts and sets (original) (raw)
Terry Reedy tjreedy at udel.edu
Wed Jan 2 23:48:26 CET 2013
- Previous message: [Python-ideas] Identity dicts and sets
- Next message: [Python-ideas] Identity dicts and sets
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
On 1/2/2013 9:01 AM, Serhiy Storchaka wrote:
I propose to add new standard collection types: IdentityDict and IdentitySet. They are almost same as ordinal dict and set, but uses
What do you mean by ordinal dict, as opposed to plain dict.
identity check instead of equality check (and id() or hash(id()) as a
By default, equality check is identity check.
hash). They will be useful for pickling, for implementing sizeof() for compound types, and for other graph algorithms.
I don't know anything about pickling or sizeof, by if one uses user-defined classes for nodes and edges, equality is identity, so I don't see what would be gained.
The disadvantage of multiple minor variations on dict is confusion among users as to specific properties and use cases.
-- Terry Jan Reedy
- Previous message: [Python-ideas] Identity dicts and sets
- Next message: [Python-ideas] Identity dicts and sets
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]