annotate python/example/ternary.py @ 814:a56a844f6e6f

add curl in k8s command
author Jeff Hammel <k0scist@gmail.com>
date Fri, 11 Nov 2016 08:37:34 -0800
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