Friday, 16 August 2013

Is there a one liner for this?

Is there a one liner for this?

Assuming search is expensive, is there a way to make this a one liner?
result = Product.search(query)
return result if result
Since the search is expensive, the following is out:
return Product.search(query) if Product.search(query)

No comments:

Post a Comment