Doing things in one line?

Gerrit Holl gerrit.holl at pobox.com
Mon Jan 3 11:17:02 EST 2000


Hello,

I know there's a FAQ entry called "Can I write obfuscated one-liners
in Python?", but for fun, I'm trying to do it now.

Can I do this in one line:
if a: foo()
elif b: bar()
else: foobar()

Is it possible with an intelligent construct that looks like:
a and foo() or a and bar() or foobar()

This does both foo() and foobar().

And what about while- and forloops?

regards,
Gerrit.

-- 
-----BEGIN GEEK CODE BLOCK----- http://www.geekcode.com
Version: 3.12
GCS dpu s-:-- a14 C++++>$ UL++ P--- L+++ E--- W++ N o? K? w--- !O !M !V PS+ PE?
Y? PGP-- t- 5? X? R- tv- b+(++) DI D+ G++ !e !r !y
-----END GEEK CODE BLOCK-----




More information about the Python-list mailing list