[issue30689] len() and iter() of ChainMap don't work with unhashable keys

2018-11-28 Thread ebw
ebw added the comment: I actually have a real life use case of that problem. Using the eval() function of pandas need to use a custom resolver: class Resolver(object): def __getitem__(self, name): if name == "test": return 0.5 else: raise KeyError

[issue30689] len() and iter() of ChainMap don't work with unhashable keys

2017-06-19 Thread R. David Murray
R. David Murray added the comment: IMO, it would actually be surprising for ChainMap to support unhashable keys. In Python, as Raymond indicates, "mapping" is pretty much synonymous with 'dict-like', and it would be where that was *not* true that we might add extra documentation. --

[issue30689] len() and iter() of ChainMap don't work with unhashable keys

2017-06-17 Thread Raymond Hettinger
Raymond Hettinger added the comment: No thank you. It is perfectly reasonable to use set operations to make the implementation simple, fast, reliable, and suitable for most use cases. Marking this as a rejected feature request. As for documentation, I don't see any need to accommodate a peda

[issue30689] len() and iter() of ChainMap don't work with unhashable keys

2017-06-17 Thread Serhiy Storchaka
New submission from Serhiy Storchaka: As documented ChainMap supports not just dicts, but mappings. A mapping can be implemented not only as a hash table, and mapping keys can be not hashable. But ChainMap.__len__ and ChainMap.__iter__ work only with hashable keys. This may be considered just