Steven Bethard a écrit :
> A.M wrote:
> > Do we have the conditional expressions in Python 2.4?
>
> bruno at modulix wrote:
>
(snip)
>
>> In the meanwhile, there are (sometime trickyà ways to get the same
>> result:
>>
>> a = 1 == 1 and "Yes&q
A.M wrote:
> Do we have the conditional expressions in Python 2.4?
bruno at modulix wrote:
> No, AFAIK they'll be in for 2.5
Yep:
Python 2.5a2 (trunk:46491M, May 27 2006, 14:43:55) [MSC v.1310 32 bit
(Intel)] on win32
>>> "Yes" if 1 == 1 else "No&qu
>> a = 1 == 1 and "Yes" or "No"
>> a = ("No", "Yes")[1 == 1]
Smart! Thanks alot.
--
http://mail.python.org/mailman/listinfo/python-list
A.M wrote:
> Hi,
>
>
>
> I am using Python 2.4. I read the PEP 308 at:
>
> http://www.python.org/dev/peps/pep-0308/
>
> I tried the statement:
>
> a= "Yes" if 1==1 else "No"
>
> but the interpreter doesn't accept it.
>
A.M wrote:
> Do we have the conditional expressions in Python 2.4?
No.
--
Robert Kern
"I have come to believe that the whole world is an enigma, a harmless enigma
that is made terrible by our own mad attempt to interpret it as though it had
an underlying truth."
-- Umberto
Hi,
I am using Python 2.4. I read the PEP 308 at:
http://www.python.org/dev/peps/pep-0308/
I tried the statement:
a= "Yes" if 1==1 else "No"
but the interpreter doesn't accept it.
Do we have the conditional expressions in Python 2.4?
Thank you,
Alan
-