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

Mark McEahern marklists at mceahern.com
Mon May 13 18:13:02 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?  In other words,
> I don't want to do:
> 
>   if b(c):
>     a = b(c)
>     use a here ...

a = b(c)
if a:
  ...

// m





More information about the Python-list mailing list