Archives for: May 2009

11/05/09

Permalink 09:02:24 am, Categories: General, 57 words   English (UK)

inline if revisited in Python

Python 2.5 comes with "conditional expressions"

As developer you often would like to write one liners to assign value to variable which is based on logical condition

old style

if condition:
    x = true_value
else:
    x = false_value

new style

x = true_value if condition else false_value

saves you time but takes time to remember new syntax !

Africa's OSS/Linux All Blogs


This blog is actually a very special blog! It automatically aggregates all posts from all other blogs. This allows you to easily track everything that is posted on this system.

May 2009
Mon Tue Wed Thu Fri Sat Sun
<<  <   >  >>
        1 2 3
4 5 6 7 8 9 10
11 12 13 14 15 16 17
18 19 20 21 22 23 24
25 26 27 28 29 30 31

Get Linux in South Africa Pretoria on DVD or CD, SUSE, OpenSuse, Fedora, Mandriva, Knoppix, Mandrake, Debian, DamnSmall, DSL, Gentoo, Slackware, SimplyMepis, Monoppix, FreeBSD, Trustix, Comodo, Smoothwall, Gibraltar, IPCop, OpenCD, Ubuntu, Kubuntu, Redhat, CentOS, Whitebox, PCLinuxOS, Xandros, Vector, Scientific, OpenOffice, Vector, Foresight, Asterisk

Search

Linkblog

Misc

Syndicate this blog XML

What is RSS?

powered by
b2evolution