Skip to content
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

Unneeded conditional statement calling parse_args #56

Closed
sanguinariojoe opened this issue Jun 4, 2015 · 2 comments
Closed

Unneeded conditional statement calling parse_args #56

sanguinariojoe opened this issue Jun 4, 2015 · 2 comments

Comments

@sanguinariojoe
Copy link

In config.py:578:

if fake_args:
  self.cliargs = cliparser.parse_args(fake_args)
else:
  self.cliargs = cliparser.parse_args()

where fake_args is None by default, however from the documentation of the arguments parser:

https://docs.python.org/2/library/argparse.html#argparse.ArgumentParser.parse_args

ArgumentParser.parse_args(args=None, namespace=None)

So calling directly to the following (without conditions):

self.cliargs = cliparser.parse_args(fake_args)

Should be the same.


Also the comparisons with 'None' should be carried out with the 'is' statement:

if fake_args is not None:

I hope it can helps!

@szaghi
Copy link
Owner

szaghi commented Jun 5, 2015

Yes, of course all your points are rigth. This is an example of my non-pythonic style... unfortunately (or fortunately) I am a Fortran poor man :-)

Thank you Pepe!

@szaghi
Copy link
Owner

szaghi commented Jun 8, 2015

Done

@szaghi szaghi closed this as completed Jun 8, 2015
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants