# HG changeset patch # User Jeff Hammel # Date 1380312156 25200 # Node ID 776d83eb0fd9f4474703fe32bd18d4bb382db356 # Parent 8c9cd7472d28f5581180e3902be9623f43de4d23 python/example/ternary.py diff -r 8c9cd7472d28 -r 776d83eb0fd9 python/example/ternary.py --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/python/example/ternary.py Fri Sep 27 13:02:36 2013 -0700 @@ -0,0 +1,11 @@ +#!/usr/bin/env python + +""" +illustrates python ternary is smart about branching +""" + +class Foo(object): + def __init__(self): + print 'hi' +bar = 1 +print Foo() if bar is None else bar