-
-
Notifications
You must be signed in to change notification settings - Fork 0
Open
Labels
enhancementNew feature or requestNew feature or requeststdlibThis issue is about the standard libraryThis issue is about the standard library
Description
builtin function that does the equivalent of this (python) function:
def get_keys_by_value(arr: dict, value) -> list:
return [k for k, v in arr.items() if v == value]
# defining dictionary
arr = {"a": 2, "b": 2, "c": 4, "e": 2}
# getting keys that point to value 2
twos = get_keys_by_value(arr, 2)
# twos now equals ["a", "b", "e"]this should probably be type checked, i.e. you can't look for a string in a dictionary that has integers. Also this should probably not be supported for doubles, since there's all sorts of silly bs going on there (e.g. -0 and +0 are not the same value). at the very least it should issue a compile-time warning.
i.e., given arr: Map<mK, mV> and value: V, the following should hold true: mV == V && V != double
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
enhancementNew feature or requestNew feature or requeststdlibThis issue is about the standard libraryThis issue is about the standard library