imageguy <imageguy1...@gmail.com> writes: > Using py2.5.4 and entering the following lines in IDLE, I don't really > understand why I get the result shown in line 8. > > Note the difference between lines 7 and 10 is that 'else' clause > result enclosed in brackets, however, in line 2, both the 'c,d' > variables are assign correctly without the brackets being required.
c,d = n if n is not None else 0,0 parses as: c,d = (n if n is not None else 0), 0 In the case where n is None, c and d are both set to 0. In the case where n is a tuple, c is set to the tuple and d is set to 0. Does that help? -- http://mail.python.org/mailman/listinfo/python-list