New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
use with argparse #3
Comments
Hi @janash , You are absolutely right on the I thought of your suggestion of adding default argument of Thank you very much for your time and comments!! |
@janash : One note: I did want to have a
Lines 33 to 122 in 1791788
Anyway, all of this probably comes from my poor planning for this code. It has evolved over time with more functions added. Thank you for your time again! |
Hello! This issue is concerning your comments on using argparse. I haven't run your code, but here are a few comments.
I see you using
global debug
a lot. This should be necessary. The variabledebug
as declared should already be "global" (ie readable inside of the functions). Since you are only reading it, I believe you do not need debug. This should be true when the file is run as a script whether or not it is in__main__
. However, if the definition is in__main__
and you run with pytest (or run functions from an import),debug
will not be defined, so tests will fail.You might try putting everything with
argparse
in__main__
and adding a default argument (debug=False
) to all of your function definitions which can be overridden with the value fromargparse
when the script is run. This way, debug is defined automatically to be False. When you use it, you will call it with the appropriate values (in__main__
, this would bedebug=args.debug
).The text was updated successfully, but these errors were encountered: