If One Line

Jacob Kruger jacob at blindza.co.za
Thu Dec 25 11:17:28 EST 2014


One line assignment is ok, but, seems like you can't perform actions.

#the following will work:
I = 1 if True else 2

#but the following will generate an error:
if I == 1: print("one")

And, not sure if/how to work around that second one myself.

Stay well

Jacob Kruger
Blind Biker
Skype: BlindZA
"Roger Wilco wants to welcome you...to the space janitor's closet..."

----- Original Message ----- 
From: "JC" <chalao.adda at gmail.com>
Newsgroups: comp.lang.python
To: <python-list at python.org>
Sent: Thursday, December 25, 2014 5:18 PM
Subject: If One Line


> Hello,
> 
> Is it possible in python:
> 
> if ((x = a(b,c)) == 'TRUE'):
> print x
> 
> Thanks.
> -- 
> https://mail.python.org/mailman/listinfo/python-list
>



More information about the Python-list mailing list