Can I use a conditional in a variable declaration?
I've done this in Scheme, but I'm not sure I can in Python. I want the equivalent of this: if a == "yes": answer = "go ahead" else: answer = "stop" in this more compact form: a = (if a == "yes": "go ahead": "stop") is there such a form in Python? I tried playing around with lambda expressions, but I couldn't quite get it to work right. -- http://mail.python.org/mailman/listinfo/python-list
Re: Can I use a conditional in a variable declaration?
Kent - Thanks for the quick reply. I tried the and/or trick - it does work. But you're right - more trouble than its worth So for now, I did it "the long way". It looks like (see below), this functionality will be added in soon. Thanks for the quick help. -sam -- http://mail.python.org/mailman/listinfo/python-list