11 ms·
> Why Is Python Growing So Quickly? Really easy to answer: It is stupid fun to program with Python. There are libraries for everything you can imagine and they
by monkmartinez 9y ago
> Why Is Python Growing So Quickly?
Really easy to answer: It is stupid fun to program with Python. There are libraries for everything you can imagine and they are generally very easy to use. Once you grok the virtual environment thing, writing apps/programs/scripts is just a matter of creating a new env and installing the libs you need. Testing ideas with Jupyter notebook is fun, fast and rewarding. Pycharm is awesome. VSCode with Python just works. You can automate tons of boring stuff (Thanks Al!)... and the list goes on... and on...
- pageandrew 9y agofor whatever reason, the word "grok" annoys me to no end
- castis 9y agoIn other words, you don't grok "grok"?
- mark-r 9y agoThe origin of the term is fascinating: https://en.wikipedia.org/wiki/Grok https://en.wikipedia.org/wiki/Grok
- deleted 9y ago[deleted]
- antod 9y agoHeh. There was a python web framework called grok.
- Zarath 9y agoFor me it's the fact that no English words end in "ok".
- drcongo 9y agoI thought it was just me.
- pvg 9y agoI think a big part of the answer for SO is the popularity and inscrutable nature of pandas. 'Popular, useful and incomprehensible' make for excellent Stack Overflow growth.
- newen 9y agoGot to agree. I used to google pandas problems for remotely complex stuff because it wasn't really intuitive how to do it in pandas. Now I have a better context for how simple such things can be because of data.table in R.
- rpazyaquian 9y agoYou're listing off tooling, libraries, and frameworks written with or targeting Python, which isn't Python itself. As soon as you want to go off the rails in any of those things, Python gets as complicated as any other language. My take on the matter is that Python is gaining traction due to its market share of the Data Science/Machine Learning field, which is what's really gaining traction and growing quickly. Had Perl or Ruby been the premier language to use for DS/ML, they would be growing instead of Python.
- schneems 9y agoThis. Most schools are moving away from C or Java being their primary language. Most comp sci professors acknowledge the usefulness of a scripting language and so when they need to pick one, they pick one they have the most familiarity with. Due to numpy and scipy this tends to be Python over Ruby. Also many things about python that I don't like such as `len` being a function rather than a method on a list are very trivial when coming from a language like C which has hordes of tiny inconsistencies. The whitespace thing in python is pretty gimmicky but does also hold a certain amount of pedantic appeal.
- xapata 9y agoThe Python design FAQ explains why Len is a built-in function instead of a method. Guido wanted a guarantee that whenever he called it, it'd return a whole number. As just another method, you might find a new type that defines a length in fractional terms, which would break any code wanting to use that as a list index, etc.
- goatlover 9y agoBut that would be on your for misusing the length method. All the built-in and popular libraries would still define length properly.
- xapata 9y agoPerhaps, but "your" mistake might impede the popularity of the language. A wide range of well-designed community libraries are a major reason to choose Python. Take a look at the design rationale for the new __matmul__ magic method. It's not for the standard library, it's for the community.
- guelo 9y agoAre you suggesting that we ignore the article's data-driven conclusion that it is because of pandas and the rise of data science and machine learning?
- rpazyaquian 9y agoThat is exactly what I am thinking myself.
- fish_fan 9y agoI think you're reading the article wrong—pandas is a symptom, not a cause. That said, it seems foolish to ignore the clear data science use case. But that's also been a theme for at least five years now.
- njharman 9y agoNo they're explaining why Pandas was written in Python and why data science and machine learning projects choose Python over R or Java or Haskell, etc.
- CJefferson 9y agoI have come to the conclusion that part of the reason python is so fun is because it is slow. There are so many lovely and easy to use libraries in Python. I took a couple and tried to be inspired by them to write a C++ library, maybe for addition to boost. However, if you are writing C++, people expect your library to be fast and memory efficient -- you can't go around sticking the entirety of a parsed file in a std::string. Also, people then start saying your code better interoperate with their templated classes well, and they want to replace the memory management entirely, and it goes on... Of course, the resulting libraries are very fast and very clever, but they have lost the joy. They also take much longer to write, maintain and use.
- paulddraper 9y agoIt's a funny way of phrasing it, but you're not wrong. C++ libraries should allow people to squeeze every bit of performance juice out of them (e.g. custom allocator). Python libraries should be intuitive to use. --- Naturally, there are exceptions, like numpy.
- fencepost 9y agoC++ may let you "squeeze every bit of performance," but in a lot of cases it does so by handing you a lot of rope. You might use it to make a rope bridge across that performance gap, but how good your bridge is depends a lot on you - and if you just manage to hang yourself with it, well, that's on you as well. With Python it may take longer to get across because you detour a mile over to a more solidly constructed bridge, but you still get there and for most cases you get there fast enough.
- harshgupta 9y agoPart of the reason is same side network effect. It makes sense to create new libraries in languages having great existing libraries.
- barrkel 9y agoWatch out for conflating abstraction level with speed. Coding at a low level of abstraction means sweating the small stuff, but it's easy to fool yourself into thinking you're making things fast - when actually, you're micro-managing. Painting with broader brushstrokes with less concern for micro-efficiencies lets you block out a solution faster. Another part of the problem with C++ is that the components come with so many rough edges that need to be filed down that you can't help getting swamped in a certain level of detail, unless you start with a large toolbox or framework that lets you work back at a higher level again. You ought to have the equivalent of Java's file stream, buffer and text decoder as three separate bits that you can compose, so that putting a whole file in a string is never even a temptation. But if you start out with a sparse toolbox, it's a slog.
- tw1010 9y agoThat description doesn't explain why there has been such a sudden growth in recent years. Python is an old language. The real reason it is growing so much just recently is of course due to ML.
- dwaltrip 9y ago> The real reason it is growing so much just recently is of course due to ML. This is certainly a potential explanation. But I don't think it is self-evident that the trend of recent growth is entirely due to this. Edit: The article supports the claim - I should have read it before commenting.
- jdc0589 9y ago> Once you grok the virtual environment thing it's incredible how hard it is to get some people on board with this. I've gotten used to good project-local package management in other langauges, I can't imaging working with anything that depended on stuff happening to be available in a global namespace ever again.
- dom0 9y agoThere are still widely used packages that don't work with pip, like PyQt.
- whipoodle 9y agoIt is a bit more of a pain to work with than similar features in other languages. Like as far as I know you can't just move a venv, you have to rebuild it in the new place. Whereas `node_modules` is just a dir. Also, there is a weird layering where venv abstracts away installed eggs/wheels/whatever they're calling them these days, but then since that's still painful to work with, you need another layer on top like virtualenvtools or burrito or whatever it is. (Sorry, it's been a couple years so my memory is fuzzy)
- Zaak 9y agoYeah, Python's environment/import logic is really convoluted. It evolved organically with little forethought, and only got a minimal pruning with Python 3.
- chrshawkes 9y agoIt was essentially created by one dude no?
- qaq 9y ago"a bit"? honestly I would say it's much closer to a lot more pain
- whipoodle 9y ago
- gdulli 9y ago> It is stupid fun to program with Python Around 2009 I started questioning if I even enjoyed coding anymore. I was primarily using PHP and Java. Rather than quit the profession I tried Python and suddenly it was fun again. 8 years later, it still is. Python just spoke my language. My career is based around using Python because it's the way I enjoy the work. Everything else, like the actual properties of Python relative to other languages, is irrelevant to me if using another language would make the work unenjoyable again. (Though if Python didn't measure up very well compared to other languages it wouldn't have become my go-to in the first place.)
- cutler 9y agoTry Clojure and I promise you will have even more fun.
- alvivar 9y agoMaybe you should try F#, to me both are kind of fun compatible (plus the functional focus that is kind of fun by itself).
- Daishiman 9y agoSame thing here. I worked with PHP and Java apps and it was just pain having to deal with the awkwardness of PHP's designs and Java's boilerplate. I actually went into sysadmin roles because of that. Python gave me hope that there's fun development roles to be had. Nowadays the panorama for good languages, thankfully, is much better. PHP is no longer that much of a dumpster fire with modern frameworks, and Java has decided to adopt better defaults and drop the XML madness. Not to mention all the good languages that have come up (Elixir, Clojure, Rust, etc).
- blauditore 9y agoI recently worked with Python for a couple of months, for the first time. Even though reading code and writing simple parts is fairly easy, I found several details to be quite confusing, like variable scope, or the various underscore conventions/variables. Also, I struggled to find a good free IDE (there was no money for PyCharm), which made debugging a hassle. Also, dependency management with pip feels a bit quirky compared to e.g. Maven or npm. All in all, I found it neither much more or less fun to program with than e.g. Java, C# or TS. It might be a better fit for small projects than others, though.
- wslh 9y agoIDE? Visual Studio Code. Python is not perfect but the final code is simple to write and understand years later.
- bedros 9y agoI use sublime for python development, don't use fancy debug features, just print statements
- cableshaft 9y agoI generally use Notepad++. Python lets you get away with it, for the most part. Other languages would be a pain in the butt to write whole programs in it.
- pletnes 9y agoPycharm and visual studio have free editions. Vim, emacs, Atom, VS Code, sublime - there are many options.
- blauditore 9y agoI think it was the remote debugger I was missing, and as far as I could tell there was no such feature in any free editor/IDE, probably because it's not a language-native feature afaik.
- 9y ago
- walterstucco 9y agoThe real answer is: data scientist everywhere They usually don't know better
- wwarner 9y agozing!
- copperx 9y agoWhat would they be using if they knew better? R?
- walterstucco 9y agoIt's ok They'd make a mess with every language... A beautiful mess, don't get me wrong There are better languages but there isn't enough "science cargo cult" around them And honestly there aren't as many code snippets to copy from My hopes are in luna[1] p.s. distributing load or using multi cores is still shitty in python, the more dataset will grow in size, the more python will struggle [1] http://www.luna-lang.org/ http://www.luna-lang.org/
- vturner 9y agoThis is an honest question, what's the size of projects you have written in Python? For me, once a project gets beyond some size, the aggravation only grows of debugging old code and adding new. Mostly, I see this is as a lack of compilation and types in Python. How do others overcome this and enjoy large Python projects?
- andybak 9y agoOK. Bear with me here. This might be overstating my case... In some sense - there are no large projects. Only projects that have failed at being modular. Maintainability involves keeping clear boundaries between functional units so that you can keep enough code in your head at any one time to reason about it. If we assume that Python is capable of handling more code than you can keep in your head at any given time, then surely the problem is simply one of making sure your modules are nicely self-contained from each other.
- vturner 9y agoAgreed, modularity definitely helps us minimize the mental load of understanding all the objects at once. But how does it handle this situation: Write function in module A that expects some complex data structure that comes in. In a static typed language, you put a type on the argument and thus guarantee, to some degree, the data in the object can be safely manipulated. Over in module B we call that function. Because Python doesn't enforce types, I can pass in some type of data structure that might behave well in many situations, but in some that function is going to fail because I didn't properly construct the data structure. How do other Python projects avoid this? Do they avoid large data structures of multiple fields?
- outworlder 9y ago> Write function in module A that expects some complex data structure that comes in. In a static typed language, you put a type on the argument and thus guarantee, to some degree, the data in the object can be safely manipulated. Let's question some of the assumptions. Do you NEED the entire thing to be passed around? If your functions are small and only do one thing, can't they be fed the portion of the data they need and only manipulate that? If they are getting unnecessary data, soon someone will like the convenience and that piece of data will now become necessary. I have seen Java projects with humongous "DAO" objects being passed across all apps. Even if Java had Haskell's type system, at some point it breaks down. So, you do not enforce that on Python itself. Rather, you have to apply due diligence and ensure your data structures are clean, and functions do what they are supposed to do and no more. > I can pass in some type of data structure that might behave well in many situations, but in some that function is going to fail because I didn't properly construct the data structure. Then you construct the structure in a single place, and that should have some sanity checks and sane defaults. Even if you are using a static typed language, there's no guarantee that what's inside the data structure even makes sense, only that the right type of structure is being passed on. That's helpful, but not as much as people would think. And you write tests. Lots of tests. It is amazing the amount of Python code that gets written without proper testing. And Java, for that matter. Only Python programmers have less excuses, it's easier to replace what you need for testing.
- mmagin 9y agoI actually love forcing people into a fairly consistent coding style, but everything else about the language irks me compared to my previous extensive use of Perl (on a large enterprise software product). One particularly big thing, that it doesn't have much of a distinct compilation phase. You'll write some script you want to run to do some one-off task that will take the next hour, only to find it crashed after 20 minutes when it hits some boneheaded syntax error you made.
- makecheck 9y agoFor that though you can use linting tools such as "pylint"; catches a lot of errors that might otherwise be runtime exceptions.
- dwaltrip 9y agoFor this reason, I generally test scripts like that with a small slice of the data, or small set of dummy data. Then one can also verify that the output is reasonable -- which is good to do even with a compiled language that would catch all syntax errors ahead of time.
- shalabhc 9y agoTake a look at mypy and pytype - there is a drive in the Python community to add a verification system to the language.
- cbr 9y agoonly to find it crashed after 20 minutes when it hits some boneheaded syntax error you made I find mypy to be pretty useful for this.
- IamNotAtWork 9y agoI haven't overcome the virtual env thing. There are a few virtual environment libraries, not sure which one to use. Then it is awkward to have to change your entire environment over by activating it and for it to be global. What if I want to work on two different projects in two different terminals? Why can't I activate an environment by just CDing into a directory with my project? Then there is the GIL. I still don't know if multithreaded python apps are really MT or just faking it. And yes, I know you can do event driven stuff and that does look very interesting.
- orf 9y agoUse "python3 -m venv" You can activate two different environments in two different terminals. Why wouldn't you be able to? You can automatically activate venvs when you cd into a directory with virtualenvwrapper. Rule of thumb: if a thread goes into C it's releasing the GIL. Not always, but often. Like reading a file, or a library like like numpy or Pillow.
- hyperpallium 9y agoJava could have libraries almost as easy to use as python, but doesn't. However, some things can't be as easy as in Python, such as sympy, which does symbolic processing of in-python expressions (differentiation, integration etc). I actually don't find python easy to use - every time I use it, I have to look up how to do for loops (what? range? zero-based? does it include the last one?), and the docs don't have links for arguments (even though they require specific types), because no static types. But the libraries absolutely are easy to use. And because many are written in C (unlike most of Java's librries), you're arguably running C.
- submeta 9y ago+1 for PyCharm. With it I realized how much I was missing with Vim/Emacs/Sublime (even though I configured a lot in those editors).
- mixmastamyk 9y ago> Once you grok the virtual environment thing I wish this would die, it just scares off newbies. In my twenty years of Python I encountered conflicting reqs once or twice. It's easy to direct folks to the documentation in those circumstances rather than cramming it down every newbie's throat---YAGNI. Now that pip can install with --user and containers are popular, the problem isn't even possible in production in many circumstances.
- donarb 9y agoVirtual environments are not just for conflicting requirements. I write code for clients on my laptop and don't want to clog up my packages directory with project specific libraries that I'll never use myself. Once the project is done and I turn code over to a client, I can delete the virtual env and all the installed libraries. Virtual envs also allow me to have multiple versions of Python installed on my machine. This discussion is a lot like version control. How many people made daily (hourly) duplicates of project folders before learning the benefits of version control?
- mixmastamyk 9y agoA use case that newbs need not concern themselves with. You normally won't get a version control lecture during every programming language tutorial either.
- deleted 9y ago[deleted]