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

bonono at gmail.com bonono at gmail.com
Fri Nov 18 18:56:09 EST 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