On 5/12/05, Chris Anderson <[EMAIL PROTECTED]> wrote:
> I believe that simply returning "1" from GetHashCode() would work just fine
> - however it would mean that hashtables would effectively become linked
> lists or linear arrays (depending on their implementation). From that model,
> returning the base CLR GetHashCode implementation for object seems
> completely reasonable... 

Returning 1 would work, yes. Returning Object.GetHashCode won't. I
don't think suprising people with hash tables returning in linear time
is good, but people coming from other CLI languages will expect it.

> The issue i'm running into is that internal data binding constructs in
> Avalon require that we push the data source for lists into a hashtable (so
> that we can manage concurrency in a reasonably performant fashion)...
> without hash support, i can never bind to lists or dictionaries from python.

Not directly, but subclassing list and dict would work.

class HashableList:
  def __hash__(self):
    return id(self)

or

clash HashableList:
  def __hash__(self):
    return 1

To adapt simply:

HashableList(MyExistingList)

Disclaimer, I'm not sure if this works in IronPython today.
_______________________________________________
users-ironpython.com mailing list
users-ironpython.com@lists.ironpython.com
http://lists.ironpython.com/listinfo.cgi/users-ironpython.com

Reply via email to