Live data from Hacker News

Homogenization of scientific computing – Python is eating other languages’ lunch

r-bloggers.com

141–150 of 184 posts

Re: Homogenization of scientific computing – Python is eating other languages’ lunch

#141
post #119
post #90

Python so slow!!

and the spacing thing... what a nightmare for copy/paste

to those downvoting the parent to this comment ... honestly, do you disagree? If so I must be missing some trick, and if so I would love to hear what it is.

Re: Homogenization of scientific computing – Python is eating other languages’ lunch

#142
post #141
post #119

Earlier quoted context omitted.

and the spacing thing... what a nightmare for copy/paste

to those downvoting the parent to this comment ... honestly, do you disagree? If so I must be missing some trick, and if so I would love to hear what it is.

What editor(s) do you use?

Re: Homogenization of scientific computing – Python is eating other languages’ lunch

#143

I do scientific computing, and Python is one language I never actually got around to learning for some reason. However, as a long-time hobby, I do have an interest in programming languages so I like exploring things like Haskell, Clojure, Lisp, etc. One language I'm really excited about for scientific computing though is Julia. From a language-design perspective, it's beautiful. It was actually thought out rather tha…

Once all of Bioconductor is ported to Julia, I will probably shed some joyous tears.

R is really nice for some things, because of how easy it is to work with table-like data, and operations like applying a function over a vector or a matrix, etc are cake. However, it's also slow, leaky (and sometime seems to use more memory after gc()), and often difficult to debug because so many things fail silently. If it wasn't for so many standard bioinformatics packages being available only for R, I'd probably be using Python. Once we stop running microarrays, I'll probably be using R much less.

Re: Homogenization of scientific computing – Python is eating other languages’ lunch

#144

I have a Python background and recently signed for the Coursera course on R that just started ( https://www.coursera.org/course/compdata ) because I wanted to get a small taste of R and see how it differed from Python's scientific computing stack. So right now I'm not far enough in the learning curve to see all the benefits R provides. Is it worth investing time in R now if I'm already pretty familiar with a good amo…

I think that is a great course, and definitely worth your time since it covers the material concisely and at a quick pace.

Re: Homogenization of scientific computing – Python is eating other languages’ lunch

#145
post #141

Earlier quoted context omitted.

to those downvoting the parent to this comment ... honestly, do you disagree? If so I must be missing some trick, and if so I would love to hear what it is.

What editor(s) do you use?

sublime text

emacs

textmate

problem is typically copying and pasting from an editor into a terminal window running python... usually for code blocks that have not just one but at least two (or more) levels of indentation

iPython and pasting with %cpaste usually helps but what if I want plain Python not iPython?

anyway it's a problem I don't have with any other language and so that's why I'm complaining about it

Re: Homogenization of scientific computing – Python is eating other languages’ lunch

#146
post #95

Earlier quoted context omitted.

Deliberately-straightforward -- agreed. But "highly proficient" after writing one or two scripts? That's quite a stretch. For instance, one of the questions I give in phone screens is for the candidate to write a program to count the number of occurrences of unique words in a text file. The "after writing one or two Python scripts" approach is something like this: counts = {} f = open('test.txt') lines = f.read().spl…

for word, count in Counter(open('test.txt').read().lower().split()).most_common(): print word, count

I like this one. Though I would do it like this to keep the lines under 80 characters:

    words=open('test.txt').read().lower().split()
    for word, count in Counter(words).most_common():
        print word, count
(edited per child comment)

Re: Homogenization of scientific computing – Python is eating other languages’ lunch

#147
post #117

Earlier quoted context omitted.

> My experience is that the whitespace is totally arbitrary: totally inconsistently placed 0 - n spaces with random indentation levels. This is usually due to: 1) Lack of a consistent style guide. 2) Lack of style guide enforcement. 3) A language where white space doesn't matter. If you think about this critically though, these random indentation changes would either break all of the code (e.g. it wouldn't run, or wo…

I guess I'm in a third camp: 3) Python's semantic whitespace is so wonderful I'm baffled that most other programming languages don't have it. It's like they're coding with one eye shut: why not do this wonderful thing that makes everything easier?

I meant to say of the people that were upset by Python's semantic whitespace, those were the two general reasons why.

Re: Homogenization of scientific computing – Python is eating other languages’ lunch

#148

Earlier quoted context omitted.

What are your thoughts on Clojure's suitability as a go-to language for scientific computing (except in lower-level, high-performance scenarios that might recommend Julia)? I think it has serious potential in this field. It's not there yet, but it's getting there, and the core.matrix standardization helps a lot.

I agree with collyw; Lisp is too much for most scientists, who just care about getting their research done and can't be bother to learn all this weird FP/paren stuff [1]. Supplying an obvious, familiar syntax that looks like math written on paper for, e.g., matrix operations, is critical. This is actually one of the core tensions in Julia development imho: balancing having a sane, well designed language (from a progr…

Just relaying the response you will get from most practicing scientists who are not trained as programmers.

Is it that hard of a gap to cross? I was a math major who took a couple CS courses, and wouldn't say I was "trained as a programmer". I found Scheme pretty easy to get from the go.

I tend to think that anyone who can get a PhD in the physical sciences can become a half-decent programmer-- if the desire is there, the intelligence and work ethic being established (one hopes, at least) by the degree.

Re: Homogenization of scientific computing – Python is eating other languages’ lunch

#149
post #95

Earlier quoted context omitted.

Deliberately-straightforward -- agreed. But "highly proficient" after writing one or two scripts? That's quite a stretch. For instance, one of the questions I give in phone screens is for the candidate to write a program to count the number of occurrences of unique words in a text file. The "after writing one or two Python scripts" approach is something like this: counts = {} f = open('test.txt') lines = f.read().spl…

Actually that's not 'highly proficient'. This is: def read_words(words_file): return [word for line in open(words_file, 'r') for word in line.split()] len(set(read_words('test.txt')))

except that's wrong, all you're doing is counting the number of unique words, and you didn't even consider Foo and foo as the same in your example. Part of proficiency is understanding the problem.

Re: Homogenization of scientific computing – Python is eating other languages’ lunch

#150

I know that I use python because of how easy it is to code. I can focus wholly, totally on the logic of my code without ever worrying about if I misplaced a semi-colon or left out some weird punctuation. Python frees me to code and not worry about things that get in the way of coding. That's why it's eating other language's lunches, the freedom is almost intoxicating.

It's ironic that you say that, given that if you don't get the whitespace correct, you'll have a syntax error. That's one of the big reason Python rubs me the wrong way: white space is semantic.

seriously? you should be properly indenting your code anyway, so it's not like python's making you do more than you should already.
Post reply on HN