* If I have a giant CSV with data in it:
import csv
with open(filename) as csvfile:
csvreader = csv.DictReader(csvfile)
data = list(csvreader)
Bam, an array of dictionaries with the data in them, indexed by column name. With listcomps, whatever I need to do will only take a few more lines. And it's this easy for almost any data format. There will be a widely used library for me to `pip install`.* I needed to plot some I/Q data and superimpose some other data as a heat map over it. Complex numbers are built in. Matplotlib, and bam, graph created. It looks as nice as the graphs my coworkers make using Matlab, and I coded it up just as fast, if not faster.
* I wanted to play around with ordering a pizza online automatically. Import requests, and off I go.
* The code is so easy to read, I've had coworkers update things I wrote when they have never programmed in Python before.
I don't have to do any compile steps. I don't have to use a special IDE. I don't have to think in objects and state-passing and all that BS (but I can if I want to!). I don't have to search for some arcane library. I don't have to know a magic build sequence. I don't have to edit config files. I just make cool shit really fast. It runs slower, but for most things I use it for, I don't care if it takes 10 us or 10 seconds. I just want to make it work.
(Which leaves me kinda sad, because I like Julia more - I'm sure it will keep growing though)
Apart from that, if one is just getting started out in data science and has never really handled a programming language before, Julia is very nice really. And their documentation is pretty damn awesome. And once you get past the performance recommendations I think it gets pretty fast (?). I'm out of my depth beyond a certain point since I've only ever experimented with it.
R's data frame concept was fantastic for those transitioning from 'spreadsheet' analysis but with Pandas, Python has improved and enhanced this concept even further.
This is just one example but I think it is this versatility that makes it more attractive than R or Julia.
I'm sure this will change if it hasn't already, especially with the better parallelization that Julia is capable of.
I think the "why" is because, for many users:
* they want a small and easy, dynamically-typed, garbage-collected language with few surprises (see `import this`). Perl misses out here.
* they want something built with C so there's easy access to native libraries. Languages on general-purpose VMs miss out here.
* I don't think they want something that transpiles/compiles down to some other lower-level language (which I suspect leads to difficult debugging). Maybe Nim misses out here.
* they're comfortable with imperative-style programming. Maybe lisps and Haskell miss out here.
* Python is fast enough for most things where C-speed isn't needed. Very-high-level languages chasing dreams of high performance mostly miss out here, IMO.
* they want a language that helps them catch their mistakes. IMO, maybe Lua misses out here (with default nil everywhere).
* Users want a general-purpose language. Again, Lua misses here, though, of course, Lua's goal isn't to be general-purpose anyway.
* I think many users also want a language that's licensed GPL-compatible. Clojure misses out here.
* they want a nice helpful community
* Users want a language with familiar C/C++/JS/Java -ish syntax. Python misses out here! {ducks}
Python has its own set of problems, but it hits all those marks except for the last one. So, it's gotten quite popular.
Of course.
> It has to be about the most readable of all computer languages.
Quite readable, sure. Though my point is that curlies and semicolons are more familiar to many (and easier to edit/navigate in my editor, for that matter), and probably would be preferred. My comment was about why I think many (not all by any stretch, of course) choose a language like Python.
The only reason I used python is that it was the first result that showed up in a Google search "write program to scrape web page" (ah beautiful soup. How I love thee!)
The only reason I used flask was Udacitys course taught their web app course with it.
I'll admit it, I've never actually analysed the benefits of a language in that way. My only judgement has been "mmm does it feel productive to use this language for what I'm doing". And "how quickly does the documentation take me to a hello world". Which is terribly subjective I admit. I'm suspecting I'm not alone. Or at least I hope I'm not :D. Yes. The embarrassment I feel is real.
PS - it's also how I ended up using nginx over Apache. I couldn't really understand Apache in 30 minutes so I used nginx instead. I even remember an interview where I was asked why I used nginx over Apache and I said "um... because it was easier I guess". Definitely not best practices and I'm trying to be more objective nowadays.
Hm. I think there's a difference between reasons for trying out a language for some random task versus staying with it. I've bounced around between lots of different languages, and I suppose the list I presented above are why lots of people stay with Python.
I think you're judgement of "mmm does it feel productive" roughly corresponds somewhat with the above list. Though I accidentally left off "good-enough docs", which I think is a given.
> I couldn't really understand Apache in 30 minutes so I used nginx instead.
Yeah. Though I think it has a lot to do with how good the docs are. Definitely, if a project can't tell me what it is, why I'd want to use it, and an overview of how it fits in, I'm very hesitant to pursue it further.
Never seen Nim in prod, but it has caught my eye and I'm curious.
I actually keep a jupyter qtconsole open to use them for ad-hoc data visualization. Pandas replaced excel for me a while ago and I cringe every time I need to abandon seaborn for a Tableau workbook these days.
GUI Visualization tools like Tableau or PowerBI seem to error towards presentation, while the defaults for seaborn help discover and visualize data while still producing results good enough to make C*O's happy.
Devops stuff is also a great one to pair with Python.
Reason I'm predicting this: I've kept an eye on Python+Flask /Django jobs for over a year now, and while I see "Python" show up more frequently now, "Flask" and "Django" are still about as frequent as they were in the past.
Looking forward to the "why" post. Glad that they mentioned that they'll be publishing that soon.