Use extended function semantics in funcy
masterMany funcy functions that typically expect a callable (a function or predicate) can instead accept non-callable objects. When you pass these objects, funcy automatically applies specific semantics based on the type of the object provided:
| Type | Mapping Function Semantics | Predicate Semantics |
|---|---|---|
None | identity(x) | bool(x) |
string | re_finder(f) | re_tester(f) |
int or slice | itemgetter(f) | itemgetter(f) |
mapping | lambda x: f[x] | lambda x: f[x] |
set | lambda x: x in f | lambda x: x in f |