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

Paul Wright -$P-W$- at verence.demon.co.uk
Tue May 14 08:54:49 EDT 2002


In article <12257ec4.0205140344.2680b226 at posting.google.com>,
David Carson <davidccarson at hotmail.com> wrote:
>So, I'll ask again: How do I do the equivalent in Python so that it is
>both clear and concise?

You do it the way everyone suggested :-) Assignment in an expression is
not valid in Python.

Aside: It's also not allowed in various restricted subsets of C. Les
Hatton's book "Safer C" says it caused an error once every 3000 lines of
C code in his test population (the error being saying = when you meant
==).

-- 
Paul Wright | http://pobox.com/~pw201 |



More information about the Python-list mailing list