Skip to content

Cached functions: cast arguments to hashable types before invocation #423

@sanjayankur31

Description

@sanjayankur31

For the few methods where we use caching, one has to use tuples instead of lists because the arguments to these methods must be hashable:

https://docs.python.org/3/library/functools.html#functools.lru_cache

If the user uses a list instead of a tuple, they get a "must be hashable" error, which will be difficult for them to understand.
So, where possible, we should cast lists to tuples ourselves, and where not possible, add assertions to inform the user what the correct form of the function call is.

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

Status

✅ Done

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions