-
-
Notifications
You must be signed in to change notification settings - Fork 1.3k
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
[New Exercise Idea]: using sys.argv #2703
Comments
🤖 🤖 Hi! 👋🏽 👋 Welcome to the Exercism Python Repo! Thank you for opening an issue! 🐍 🌈 ✨
- If you'd also like to make a PR to fix the issue after discussing it,
❗ Please do not run checks on the whole repo & submit a bunch of PRs. ❗ Please keep in mind that inserting only blank lines, making a closing bracket drop to the next line, changing a 💙 While you are here... If you decide to help out with other open issues, you have our gratitude 🙌 🙌🏽. Here to suggest a feature or new exercise?? Hooray! 🎉 Please keep in mind Chesterton's Fence. |
However, if the purpose of this would be to get someone used to the command line (not Python), then I would recommend that they do some exercises on the Bash track. If we're talking the real-world use of Python for configuration scripts and other command-line mini-tools, then yes -- a concept exercise on the Feels like a better exercise might be one using @J08K -- your thoughts on this? 😄 |
I am not sure I understand why would writing tests be difficult?
After having one or two exercises with plain |
https://docs.python.org/3/library/sys.html#sys.argv. Please note the section where it says that the path names are dependent on the file system. This is not about us testing a linux script. This would be about us testing that the student has correctly written code that parses command line arguments.....using their OS. |
So, if you look at the official So, almost anything from the I do think it can be important for a student to know how to write a proper |
Given the plethora of higher level and more modern tools for handling commands and flags, e.g. click, would teaching argparse be the most value for time? |
The advantage I see with But I agree that click (and possibly fire) are superior. The issue with those is that they are third-party libs. And we could very well include them and make exercises about them....but we should also thoroughly cover the used and useful parts of the standard lib first. And no: I am not advocating for a concept exercise on That being said -- there are some third-party libs that are just ... really standard. Numpy and its relatives come to mind, as does |
I think as a concept one first needs to understand that the user can put values on the command line that appear as a As I read the python documentation, it seems to indicate that the content of I think the exercises should focus on that part of the list, BTW in some other languages, the corresponding variable does not contain the name of program. It only contains the parameters. For example |
People coming from a GUI-only background will have a lot of fun getting used to the command-line. IMHO it would be a good idea to have them practice. I'd be happy to contribute one or more of my super-simple exercises:
https://code-maven.com/slides/python/exercise-rectangle-argv
https://code-maven.com/slides/python/exercise-calculator-argv
This might require the understanding of lists, though one could explain how to use
sys.argv
and forward reference to list saying "more detailed explanation will follow".The text was updated successfully, but these errors were encountered: