How to do "new_variable = (variable) ? True : False; " (php) on python?

bonono at gmail.com bonono at gmail.com
Sat Nov 19 00:56:09 CET 2005


Peter Otten wrote:
> Daniel Crespo wrote:
>
> > How can I do
> >
> > new_variable = (variable) ? True : False;
> >
> > in Python in one line?
>
> new_variable = variable
>
> :-)

I would assume the OP is just lazy and don't want to type :

new_variable = (variable_is_true_value) ?
some_expression_when_variable_is_true_value is true :
some_expression_when_variable_is_true_value is false

rather than simple True/False.




More information about the Python-list mailing list