News for hackers. Stuff that matters.
Re:Learning to Program: Why Python? by fusiongyro on Tuesday May 08, 2012 @06:19PM (#3946071)
A lack of freedom can be a good thing in a first language. Of course, Python doesn't always have a "right way" or they wouldn't be on their fourth command line argument parsing library. ;)

Ruby and Python will seem more similar after knowing a lot of languages. But they are different enough too. If it's not intimidating you it's probably a good second language.

Re:Learning to Program: Why Python? by slurgfest on Wednesday May 09, 2012 @02:49AM (#3947350)
Why do I keep reading about this? I don't see how any command line argument parsing library is relevant other than argparse. Do you have some concrete complaint about argparse? I am seriously wondering what I am missing, it seems so simple to me yet this seems to be a burning perennial complaint.
Re:Learning to Program: Why Python? by gvalkov on Wednesday May 09, 2012 @06:48AM (#3947934)
Why shouldn't they be relevant? Getopt is still very useful for short scripts and optparse does everything it was meant to do, even if it's not as full of features as argparse. Maybe argparse really should be the canonical choice, but I certainly wouldn't want to see the others gone.

As for a minor complaint about argparse - setting up a custom help formatter [1] is not straightforward, not in the slightest in comparison to optparse [2] (which is much simpler, implementation wise).

[1] http://hg.python.org/cpython/file/default/Lib/argparse.py#l1...

[2] http://hg.python.org/cpython/file/2.7/Lib/optparse.py#l155

Re:Learning to Program: Why Python? by fusiongyro on Wednesday May 09, 2012 @12:10PM (#3949194)
Forgive me, I started with 1.5.2. Back then, you used getopt. Then came optparse. Then came argparse. So I guess there have only been three, unless there's a popular non-built-in option I don't know about.

Now, I haven't had to maintain anything I wrote back then (not sure I ever even did use getopt) but if I'm sure if we looked we could find someone who has upgraded their option parsing twice.

I'm being a little snarky. I'm really just trying to point out to the new user that the much-vaunted "TOOWTDI" concept is at best a policy decision and is to be taken with a grain of salt rather than treated like a straight-jacket. There's always more than one way to do something. Python just doesn't endorse the kind of free-for-all on every line that Perl does.