Show HN: A set of handy tools to work with sequences and collections in Python
github.com
github.com
where([{1 : 'a', 2 : 'b'}, {1 : 'b'}], 1='a')
SyntaxError: keyword can't be an expression
where([{1 : 'a', 2 : 'b'}, {1 : 'b'}], **{1:'a'})
TypeError: where() keywords must be strings
edit: this is based on my own naive "where" implementation, but these are limitations of the languageThat was a deliberate choice.
some([0, '', -1, None, 2]) # -1
should be some(odd, [0, '', -1, None, 2]) # -1So, first example is the same as:
some(bool, [0, '', -1, None, 2])Some of itertools things are just reexports and builtins are extended purely - so that they behave the same given same arguments - with negligible performance overhead.
Anyway, if you are such a purist you still have at least two options: 1. just `import funcy` and use it as `funcy.map(...)` or `funcy.keep(...)` 2. Import only functions you use, avioding name clashes, use `from funcy import map as xmap` to import extended builtins.