bpo-33134: dataclasses: use function dispatch table for hash, instead of a string lookup which then is tested with if tests. (GH-6222)

* Change _hash_action to be a function table lookup, instead of a list
of strings which is then tested with if statements.
This commit is contained in:
Eric V. Smith 2018-03-24 22:10:14 -04:00 committed by GitHub
parent f96ddade00
commit 01d618c560
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 39 additions and 40 deletions

View file

@ -0,0 +1,3 @@
When computing dataclass's __hash__, use the lookup table to contain the
function which returns the __hash__ value. This is an improvement over
looking up a string, and then testing that string to see what to do.