-
Notifications
You must be signed in to change notification settings - Fork 10
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
method for arg parsing #11
Comments
I just finished submitting a pull-request seconds before getting this, looks similar, let me know what you think. |
also, the parser is not an iterable item |
Sys.argv is, no?
|
argparse library and sys.argv are way different. argparse is meant to simplify command-line handling, not positional and can be required or optional. if we use sys.argv, that's essentially a list of strings, so we're getting into manipulation of strings to find the place where -i is, where -m is and so forth. something like if sys.argv[1] == '-i' or sys.argv[1] == --ip_address:
self.address = sys.argv[2]
# 2 because 1 would be the position and 2 where the actual value you want would be,
# but that's hoping. and you can see the chaining of if statements that would require, even if we put it in a for loop, it's not efficient, how many times do we need to iterate to find the actual values? hence why I structured it the way I did. |
Yup. I knew they were different, just not sure how. Have heard very good things about argpasrse though! Will take a look later. Thanks.
|
Yandy,
I started the work to create a method for arg parsing as mentioned earlier. Now you can see what I mean. The method is only used when running it as a program. Feel free to finish it....if not, I'll try to later in the week too... :)
The text was updated successfully, but these errors were encountered: