annotate python/example/ternary.py @ 794:e059c4e85d9f

add docker cleanup helper
author Jeff Hammel <k0scist@gmail.com>
date Wed, 19 Oct 2016 09:04:34 -0700
parents 776d83eb0fd9
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
541
776d83eb0fd9 python/example/ternary.py
Jeff Hammel <jhammel@mozilla.com>
parents:
diff changeset
1 #!/usr/bin/env python
776d83eb0fd9 python/example/ternary.py
Jeff Hammel <jhammel@mozilla.com>
parents:
diff changeset
2
776d83eb0fd9 python/example/ternary.py
Jeff Hammel <jhammel@mozilla.com>
parents:
diff changeset
3 """
776d83eb0fd9 python/example/ternary.py
Jeff Hammel <jhammel@mozilla.com>
parents:
diff changeset
4 illustrates python ternary is smart about branching
776d83eb0fd9 python/example/ternary.py
Jeff Hammel <jhammel@mozilla.com>
parents:
diff changeset
5 """
776d83eb0fd9 python/example/ternary.py
Jeff Hammel <jhammel@mozilla.com>
parents:
diff changeset
6
776d83eb0fd9 python/example/ternary.py
Jeff Hammel <jhammel@mozilla.com>
parents:
diff changeset
7 class Foo(object):
776d83eb0fd9 python/example/ternary.py
Jeff Hammel <jhammel@mozilla.com>
parents:
diff changeset
8 def __init__(self):
776d83eb0fd9 python/example/ternary.py
Jeff Hammel <jhammel@mozilla.com>
parents:
diff changeset
9 print 'hi'
776d83eb0fd9 python/example/ternary.py
Jeff Hammel <jhammel@mozilla.com>
parents:
diff changeset
10 bar = 1
776d83eb0fd9 python/example/ternary.py
Jeff Hammel <jhammel@mozilla.com>
parents:
diff changeset
11 print Foo() if bar is None else bar