Rocking the blogosphere
Apple Online Store

Software development quote of the day

Spotted at http://www.holub.com/:

“Excessive or irrational schedules are probably the single most destructive influence in all of software.”

-Caspers Jones

links for 2008-05-31

links for 2008-05-28

  • OpenC++ is C++ frontend library (lexer+parser+DOM/MOP) and source-to-source translator. OpenC++ enables development of C++ language tools, extensions, domain specific compiler optimizations and runtime metaobject protocols.
    (tags: c++ parser)

links for 2008-05-24

Python ternary operator

Today’s Python discovery:

Python doesn’t have the C style ?: ternary operator (e.g.: cond ? valueIfTrue : valueIfFalse).

But as of Python 2.5 it has a ternary operator with its own syntax: value_when_true if condition else value_when_false

For example:

>>> 'a' if 1 == 1 else 'b'
'a'
>>> 'a' if 1 == 0 else 'b'
'b'

This is actually clearer and more Pythonic than that ?:

Unfortunately, for Python versions < 2.5, you don’t have this. I’ve seen people use: (condition and [value_when_true] or [value_when_false])[0]

IMHO, this is clever - in a bad way. Yuck. Personally, I think I’d rather just do:


def if_cond_val1_else_val2(cond, val1, val2):
   if cond: return val1
   else: return val2

This adds 3 lines to your program (or 1 if you stick it in a module that you import from your programs) and won’t cause your colleagues to hate you.

Song from the Bank of America Commercial

A recent B of A commercial has a female acoustic singer/songwriter song, which sounds very similar to Shawn Colvin to me, but alas, it’s not Shawn Colvin.

It’s “Merry-Go-Round” by Antje Duvekot

links for 2008-05-09

« Previous PageNext Page »

Apple Online Store
Apple Online Store