If you benefit from web2py hope you feel encouraged to pay it forward by contributing back to society in whatever form you choose!
Can you post an example?
I don't really get it. Are you just joining the queries with "&"
How about
q = reduce((lambda a,b:a&b), args)
?
This one has a problem if args is empty, but your solution also has that problem... hard to solve because the empty query makes no sense !
Thank you @pang! As I said in previous comment an easiest (and more pythonic) solution can be found... and you found it! :)
A little trick to sum up or multiply a list of query conditions.
0
pang 9 years ago
Can you post an example?
I don't really get it. Are you just joining the queries with "&"
How about
q = reduce((lambda a,b:a&b), args)
?
This one has a problem if args is empty, but your solution also has that problem... hard to solve because the empty query makes no sense !
replies (1)