[issue27358] BUILD_MAP_UNPACK_WITH_CALL is slow

Emanuel Barry report at bugs.python.org
Tue Jun 21 09:15:19 EDT 2016


Emanuel Barry added the comment:

`dict` subclasses can be hashable - it's a very bad idea, but not guarded against. If you were to do this, I'd suggest going the exception way, à la StopIteration.

I wonder how feasible it would be for e.g. dict.__setitem__ to check if a key already exists; it would be a special path that's not taken normally, but filling the mapping on call enables it, and it raises if it sees a duplicate. I think that inserting the check in there would reduce complexity and probably have a negligible impact on performance. I don't know if that's a good idea, just throwing this out here.

----------
nosy: +ebarry

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue27358>
_______________________________________


More information about the Python-bugs-list mailing list