Steven D'Aprano wrote: > On Wed, 14 Dec 2005 14:09:10 -0500, Andy Leszczynski wrote: > > >>How can do elegantly in Python: >> >>if condition: >> a=1 >>else: >> a=2 >> >>like in C: >> >>a=condition?1:2 > > > I thought you wanted to do it *elegantly*? > > Your first solution is perfectly elegant to my eyes, unlike that horrible > C syntax.
I can tell you what is not elegant in the if else: approach. It is logically a one operation while you are forced to use varaible "a" twice. Fundamental flaw IMO. A. -- http://mail.python.org/mailman/listinfo/python-list