Raymond Hettinger <raymond.hettin...@gmail.com> added the comment:
> the author had forgotten the `tuple(...)` call (or incorrectly > assumed a parenthesized generator was a tuple comprehension) Presumably that will bite the author in many ways, not just hashability. There are many other places where substituting a generator for a tuple would result in a downstream error. ISTM, this user error would have been caught with even minimal testing or code review. > it seems wrong that generators are currently hashable as they are mutable It is perfectly reasonable given that generators compare based on object identity. > Thoughts on `__hash__ = None` for generators? That would break currently working code that depends on hashability. I have seen such code in production more than once (using distinct generator instances as dictionary keys for example). ---------- _______________________________________ 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