[IronPython] IronPython.Objects.List doesn't support GetHashCode()
Chris Anderson
chrisan at gmail.com
Thu May 12 18:39:55 CEST 2005
The problem with this model is that it requires you to subclass and use a
special type. My goal is to enable simple usage in binding scenarios:
_list.ItemsSource = range(5)
This means that every list/dictionary/touple needs to support
ICustomTypeDescriptor and GetHashCode/SyncRoot... The ICD requirement for
object/dict is pretty solid, but I'll follow up with our databinding team to
see if we can gracefully support non-hash supporting objects...
I'm unclear as to why returning the default CLR implementation of
GetHashCode would be bad? It's unique to the life of the object and never
changes... it won't be based on the containing data in the list, but it also
shouldn't break any hashtable... no?
On 5/12/05, Timothy Fitz <firemoth at gmail.com> wrote:
>
> 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.
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/ironpython-users/attachments/20050512/65307888/attachment.html>
More information about the Ironpython-users
mailing list