I suspect theres a better way of doing things, but consider the following code:
It's almost like a try block but I feel like it reads better...
opinions?
here is a link to a full example:
https://github.com/rexlx/ternary_fallthr...example.py
1 2 3 4 5 |
def get_args(): if len (sys.argv) > 1 : val = int (sys.argv[ 1 ]) if int (sys.argv[ 1 ]) else fallthrough else : print ( "expected a number as an arg" )[ / font] |
opinions?
here is a link to a full example:
https://github.com/rexlx/ternary_fallthr...example.py