3 ms·
the interface to "where" could use a little rethinking. not all keys are constant string values that are legal identifiers. e.g. where([{1 : 'a', 2 : 'b'},
by shoo 14y ago
the interface to "where" could use a little rethinking. not all keys are constant string values that are legal identifiers. e.g.
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 language
- Suor 14y agoYes, where() doesn't handle that case, but it makes its interface more smooth for more common case of string keys. That was a deliberate choice.