[Python-de] (no subject)

Dinu Gherman gherman at darwin.in-berlin.de
Wed Oct 9 15:03:10 EDT 2002


Josef Cihal:

> geht etwas ähnliches einfacher in Python zu schreiben?
>
> if a=None:
> 	h=10
> elsif a= 1
> 	k=20
> else:
> 	k=10
>
> ...mit einer Funktion, z.B.?:

lambda x: {None:10, 1:20}.get(x, 10)

Dinu

--
Dinu C. Gherman
......................................................................
"The first principle is that you must not fool yourself - and you are
the easiest person to fool." (Richard Feynman)





More information about the Python-de mailing list