1-line idiom to replace if blocks

Jonathan P. jbperez808 at yahoo.com
Tue Jan 21 09:17:00 CET 2003


**** Post for FREE via your newsreader at post.usenet.com ****

I hate code that takes up too many lines and
have come up with the ff. idiom to replace
many 4 line if statements:

result=[value-if-false,value-if-true][condition]

This idea could also be applied as a compact
switch block replacement in certain cases.









-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
 *** Usenet.com - The #1 Usenet Newsgroup Service on The Planet! ***
                      http://www.usenet.com
Unlimited Download - 19 Seperate Servers - 90,000 groups - Uncensored
-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=




More information about the Python-list mailing list