(May-05-2021, 07:02 PM)rexrf Wrote: heres what is happening:if
val = int(sys.argv[1]) if int(sys.argv[1]) else fallthrough
sys.argv[1]
is not convertable to int it will not reach the if part at all because you will get exception.Not to mention that converting to int twice is redundant. try/except is much cleaner and idiomatic.
As a side note, the 57 lines in your example can be shortned to ~ 20 if done properly - there is a lot of redundant code
If you can't explain it to a six year old, you don't understand it yourself, Albert Einstein
How to Ask Questions The Smart Way: link and another link
Create MCV example
Debug small programs
How to Ask Questions The Smart Way: link and another link
Create MCV example
Debug small programs