set using alternative hash function?

Anthony Tolle anthony.tolle at gmail.com
Thu Oct 15 10:52:47 EDT 2009


On Oct 15, 10:42 am, Austin Bingham <austin.bing... at gmail.com> wrote:
> On Thu, Oct 15, 2009 at 4:06 PM, Anthony Tolle > To reiterate, dict only gets me part of what I want. Whereas a set
> with uniqueness defined over 'obj.name' would guarantee no name
> collisions, dict only sorta helps me keep things straight; it doesn't
> actually enforce that my values have unique names.
>

I don't understand how a set would help you enforce that your values
ave unique names.  If you have two objects, both named "foo", and
added them to the set, no errors would occur.

Please provide an example of how a set provides functionality that a
dict (which enforces unique keys) doesn't.




More information about the Python-list mailing list