New submission from Anthony Sottile <asott...@umich.edu>:
We recently found a bug in one of our codebases that looked ~roughly like this: class C: ... def __hash__(self): return hash((v for k, v in sorted(self.__dict__.items()))) which resulted in a production bug The *intention* was to hash a tuple of those elements but the author had forgotten the `tuple(...)` call (or incorrectly assumed a parenthesized generator was a tuple comprehension) -- either way it seems wrong that generators are currently hashable as they are mutable Thoughts on `__hash__ = None` for generators? ---------- components: Interpreter Core messages: 356382 nosy: Anthony Sottile priority: normal severity: normal status: open title: generators are currently hashable versions: Python 3.9 _______________________________________ Python tracker <rep...@bugs.python.org> <https://bugs.python.org/issue38769> _______________________________________ _______________________________________________ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com