db(query) returns a Set object. The Set class has a __call__ method <https://github.com/web2py/pydal/blob/32cde26be1913c67738f21f1a674f5dadfe72a8a/pydal/objects.py#L2052>. In Python, when a class has a __call__ method, instances of the class are *callable*, meaning they can be treated like functions and you can call them (with arguments). If you look at the code of the __call__ method linked above, you can see when you call a Set object, it takes a query, and the result is a new Set object that joins the original query with the new query via &. So, to clarify, we have:
myset = db(original_query) # This is a callable object. mynewset = myset(additional_query) # We now call the original set with an additional query. Of course, the above can be done all in one line, as you see in the original example: db(original_query)(additional_query) which yields the same final Set as: db(original_query & additional_query) Note, this extends to as many queries as you want: db(query1)(query2)(query3)(query4) Anthony -- Resources: - http://web2py.com - http://web2py.com/book (Documentation) - http://github.com/web2py/web2py (Source code) - https://code.google.com/p/web2py/issues/list (Report Issues) --- You received this message because you are subscribed to the Google Groups "web2py-users" group. To unsubscribe from this group and stop receiving emails from it, send an email to web2py+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.