Skip to content

Allow to pass a callable for field-level hash #1076

Open
@hynek

Description

@hynek

Apparently, being able to customize the hashing of individual fields is something interesting for NumPy users: https://stackoverflow.com/q/74975393/476759


I guess the idea would be to create a __hash__ that looks like this:

def __hash__(self):
    return hash((self.a, custom_hash_for_b(self.b)))

while injecting custom_hash_for_b into eval's globals.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions