For review: PEP 308 - If-then-else expression

Bengt Richter bokr at oz.net
Sun Feb 9 14:33:44 EST 2003


On 9 Feb 2003 05:11:22 -0800, janto_d at hotmail.com (Janto Dreijer) wrote:
[...]
>An out-of-bounds error in python?
>The only equivalent I can think of is a dict lookup for a non-existent
>key. And that would be done better with ``x = dict().get(key,
>default)``.

    result = 0<=i<len(seq) ? None, seq[i]   # cond ? expr_false, expr_true

Regards,
Bengt Richter




More information about the Python-list mailing list