If you benefit from web2py hope you feel encouraged to pay it forward by contributing back to society in whatever form you choose!


  • 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 smiley!

    replies (1)
    • manuele 9 years ago

      Thank you @pang! As I said in previous comment an easiest (and more pythonic) solution can be found... and you found it! :)

Commented on:

A little trick to sum up or multiply a list of query conditions.

Hosting graciously provided by:
Python Anywhere