News for hackers. Stuff that matters.
Re:Learning to Program: Why Python? by horsehead on Tuesday May 08, 2012 @06:15PM (#3946054)
I just want to say that I've been learning Python as my first language. I've found it to be fairly intuitive and a lot of fun. Of course, learning any language, especially your first, is going to be difficult, though.

One of the drawbacks I've heard is that Python subscribes to the idea of doing something 'the right way,' although i've found a few times where i did something the 'not right way' and it was still functional (although maybe a little longer or not as clean as it could have been).

Edit: I've also been involved a little bit with Ruby lately, and it seems thre are a few similarities between the two. Though that could just be that there are many similarities between any two langauges, and I'm just not familiar enough with multiple languages to realize that :P

Still, it's an excellent first language, IMO

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.

Re:Learning to Program: Why Python? by antidoh on Tuesday May 08, 2012 @11:40PM (#3947006)
"The right way" is not always enforced by the language. It's often just conventions agreed to by the dominant community. "Pythonic" is a word that you'll hear a lot, if you haven't already.
Re:Learning to Program: Why Python? by slurgfest on Wednesday May 09, 2012 @02:50AM (#3947354)
It doesn't seem to mean much of anything consistent, though, because it is used as a sort of generic positive adjective and used to promote even things of dubious quality.
Re:Learning to Program: Why Python? by antidoh on Wednesday May 09, 2012 @03:08AM (#3947404)
And that's sometimes what the "right" way is, just a way.