On 26/12/2014 1:18 AM, JC wrote:
Is it possible in python:

if ((x = a(b,c)) == 'TRUE'):
        print x

One approach is to use a function in the condition to do the assignment:

    x = None

    def assign_to_x(val):
        global x
        x = val
        return val

    def a(x, y):
        return 'TRUE'

    b, c = 'foo', 'bar'

    if assign_to_x(a(b,c)) == 'TRUE':
        print(x)

--
https://mail.python.org/mailman/listinfo/python-list

Reply via email to