Feature suggestion -- return if true

Gregory Ewing greg.ewing at canterbury.ac.nz
Sun Apr 17 20:25:42 EDT 2011


Steven D'Aprano wrote:

> I'm sure you realise that that snippet needlessly recalculates any cached 
> result that happens to be false, but others reading might not.

I only use it as written when I'm dealing with types that
don't have false values. If I did need to cache such a
type, I would use a different test, such as 'if y is None'.

-- 
Greg



More information about the Python-list mailing list