News for hackers. Stuff that matters.
Re:Why Python is Important for You by sdfjkl on Saturday February 11, 2012 @08:44PM (#3580797)
Many years ago I've decided it was time to pick up a modern programming language. In the past I had written lots of (Turbo) Pascal code, some x86 (and more exotic) Assembler and a bit of C, but then for several years I only did shell/awk scripts and ported C software to IRIX and SINIX/RU.

So I sat down and decided to find a nice general-purpose language that I would focus on learning. I wasn't quite sure what for yet, but I decided I was going to pick one and stick with it. I didn't have the time to learn multiple languages and I didn't have a lot of time to try out different ones, so I just looked around a little bit. Some I ruled out early: C and it's relatives were just too verbose, I didn't want to spend the time writing all the error handling necessary just to read a damn file. I was doing a lot of sysadmin type work at the time and had therefore developed an intense disliking for Java. This was based on too much badly packaged Java software that even if you got it running at all was sluggish, hogging way too much memory and crashed with arcane error messages. I did like the quick & dirty way I could make things work in a shell script, so I looked mostly at scripting languages.

I looked at Perl, which was the standard scripting language at the time and had a huge library (CPAN) of modules, which was great. I hated the syntax though and found the code often unreadable and there being too many ways of doing the same thing.

I looked at Pike, which had the benefit of using a C syntax (which I already knew, so that was a plus), but it seemed not widely supported and nobody was using it (this hasn't changed since, it seems).

I don't remember what else I looked at, but then there was Python. The syntax was a revelation. Here someone had finally made the most of creating a language from scratch and spent the time thinking about syntax and how to do away with largely pointless stuff (brackets), replacing it with things that everyone did anyways (indentation). It also came with a sizeable library of stuff that did almost everything I could dream of at the time. It was love at first sight.

Recently I've spent £35 on a stainless steel mill that grinds salt when you twist it one way and pepper when you twist it the other way, just because I really love well thought out and engineered things that make stuff that's been around forever just a little bit better. That's how I feel about Python. It's not doing anything fantastically new or unique, but it's doing the stuff that others do just a little bit better.

Today I'm doing lots of web stuff, some sysadmin stuff and random hacking of various things on the side. I'm still doing almost everything in Python and whenever Javascript bitches at me about a missed semicolon I do think: "All these fantastic things you can do in a web browser these days and you couldn't figure out that this command in an entirely different line isn't part of the previous line?".

The only thing that I can't do in Python is write software for my iPhone, which bugs me a bit. But every time I try to get into Objective C I just get annoyed by the syntax and amount of cruft I have to write to do anything.

Re:Why Python is Important for You by mekoka on Saturday February 11, 2012 @09:12PM (#3580873)
I'm still doing almost everything in Python and whenever Javascript bitches at me about a missed semicolon I do think: "All these fantastic things you can do in a web browser these days and you couldn't figure out that this command in an entirely different line isn't part of the previous line?".

I hear you about Python, but JavaScript doesn't require semicolons either, as far as I know. The main reason it's advisable to put them is to avoid ambiguity when 2 statements find themselves on the same line, for example, in a minified js file. Python uses semicolons for the same reasons, but minifying Python files is quite uncommon (and would probably serve no real purpose).

Re:Why Python is Important for You by tcard on Saturday February 11, 2012 @09:33PM (#3580923)
JS semicolons are actually encouraged —omitting them, while syntactically valid, can lead to obscure bugs. http://bonsaiden.github.com/JavaScript-Garden/#core.semicolo...
Re:Why Python is Important for You by ludwigvan on Sunday February 12, 2012 @04:27AM (#3581461)
If you are following Crockford (JavaScript, the Good Parts), it is encouraged. However, some, like the current node.js maintainer think otherwise; see http://blog.izs.me/post/2353458699/an-open-letter-to-javascr...

Personally, I still follow Crockford's advice though.

Re:Why Python is Important for You by wyuenho on Sunday February 12, 2012 @12:08PM (#3582268)
And you guys just demonstrated yet another reason why I choose Python for my go-to scripting language. Semicolons are completely redundant in Python and the language is so clean and the style guide PEP 8 is so natural, you rarely hear about these meaningless formatting style bickering in other languages. Saves so much time from arguing.
Re:Why Python is Important for You by nextparadigms on Sunday February 12, 2012 @05:56AM (#3581558)
You can write in Python for Android, in case you're considering changing your phone so you can write in Python for it:

http://google-opensource.blogspot.com/2009/06/introducing-an...

http://code.google.com/p/android-scripting/

https://github.com/kivy/python-for-android

Re:Why Python is Important for You by bandarman on Sunday February 12, 2012 @03:38AM (#3581403)
Python does have the strength in all the powerful libraries it makes available to you, and that may be a determining factor in the relative popularity of Python v. Ruby in the future.

I've used Python for many years but recently took a serious look at Ruby to see what it has. I haven't looked back - I found Ruby to be less verbose and still easy to read, and very enjoyable to code in. Python was enjoyable too, but for me, Ruby much more so.

Re:Why Python is Important for You by Kliment on Sunday February 12, 2012 @09:12AM (#3581810)
Mildly offtopic, but do you have a link to that mill? Or, if it is patented, can you copy the patent number off the side? I love mechanisms like that.
Re:Why Python is Important for You by sdfjkl on Sunday February 12, 2012 @06:39PM (#3583448)
Re:Why Python is Important for You by bmelton on Saturday February 11, 2012 @10:32PM (#3581012)
Syntactically, JS is funny in a lot of ways.

I highly encourage you to investigate CoffeeScript.

Re:Why Python is Important for You by craigyk on Saturday February 11, 2012 @10:55PM (#3581056)
As someone with lots of Python experience, having used CoffeeScript/JS for ~three months makes Python looks somewhat old fashioned when I switch back. If Coffee/JS had some way of overloading array access operations, and maybe a numpy equivalent, I don't think I would have any reason to go back to Python. It's also just so much faster than CPython...
Re:Why Python is Important for You by attractivechaos on Sunday February 12, 2012 @09:10AM (#3581804)
I actually quite like Javascript, especially for its speed. However, the major obstacle to me is that JS is locked in web development. It even does not have a standardized module to read files line by line, let alone other system-level stuffs. One of the (small) reasons that python is not used in web browsers is the lack of speed.
Re:Why Python is Important for You by tikhonj on Sunday February 12, 2012 @02:16AM (#3581317)
The upcoming version of JavaScript--some engines already support this, I think--includes support for "proxies" which basically let you overload both array access (a['b']) and . access (a.b) for an object.
Re:Why Python is Important for You by reuser on Sunday February 12, 2012 @02:43PM (#3582748)
Please share your data showing that Coffeescript is faster than CPython
Re:Why Python is Important for You by gtaylor on Saturday February 11, 2012 @11:45PM (#3581123)
Sounds like Apples to Oranges...
Re:Why Python is Important for You by mistercow on Sunday February 12, 2012 @08:59PM (#3583847)
Yes, but it's an Apple with multiline lambdas vs. an Orange with only single-line lambdas.