python for this C: "if ((a = b(c)) != NULL)"

Kalle Svensson kalle at lysator.liu.se
Mon May 13 18:16:45 EDT 2002


[David Carson]
> So, how do I do this in Python, since I want to avoid running method
> b() twice in the case where I want to use 'a' later?

a = b(c)
if a: # or maybe "if a is not None:"
    do stuff

Peace,
  Kalle
-- 
Kalle Svensson, http://www.juckapan.org/~kalle/
Student, root and saint in the Church of Emacs.





More information about the Python-list mailing list