3 ms·
In this ORM, both versions construct without executing until the results are accessed. The list comprehension looping over the results is an access, the "if" ha
by Izkata 3y ago
In this ORM, both versions construct without executing until the results are accessed. The list comprehension looping over the results is an access, the "if" happens after that.
The one exception to the obvious "results are accessed" intuition is slices (such as [:3] to mean first 3 elements), which thanks to how python implemented them lets the ORM use them to further modify the query by adding LIMIT instead of executing it.