
Python overtakes JavaScript as most questioned language on StackOverflow - nnx
https://www.globalapptesting.com/blog/picking-apart-stackoverflow-what-bugs-developers-the-most
======
jononor
Gah, those wordclouds are horrible attempts of analyzing "what the questions
are about". There is no attempt at normalizing term frequency, or removing
non-informational words. So words like "get" and "using" get a high score.

It may also seem that the text analyzed is the entire post including metadata.
For instance "closed" and "duplicate" both show, maybe just be because of
"closed as duplicate"... Maybe even including the answers. Which could explain
why "pip" would show up so often.

The summaries are also pretty off. "vector" mostly because C++ is about 3D
graphics vectors? No, probably just a whole lot of std::vector...

~~~
kijin
Some of the simple words and their prominence can be amusingly informative,
though.

Take data structures for example. "string", "array", and "object" are about as
equally prominent in both JavaScript and Ruby (where the dictionary is called
"hash"). In Python, however, "string" and "list" far outweigh "dictionary" and
"object", which probably says something about what kind of data structures
Python developers deal with the most in their lives. Meanwhile, C# and Java
seem to be all about strings -- Are people just casting everything to string
because they don't want to deal with strict types? -- and PHP is the only
language where more people feel like they need to ask about arrays than they
do about strings. Which is not surprising since PHP uses arrays for basically
everything.

~~~
coherentpony
> In Python, however, "string" and "list" far outweigh "dictionary" and
> "object", which probably says something about what kind of data structures
> Python developers deal with the most in their lives.

This statement is not true at all. There are plenty of developers that don't
post questions to or answer questions on StackOverlow.

~~~
bepvte
Not saying anything about the parent comment, but the method of studying a
large population by using a sample size is pretty common and time tested.

~~~
stock_toaster
Yes, but SO participation is self selecting (self-selection bias), and is not
a random sample of the larger union of non-SO and SO population.

~~~
coherentpony
And the 'statistics' on the data was presented as a word cloud, which is not a
time-tested way to understand statistical relationships.

------
z3t4
Seems like the most difficult programming is no longer cache invalidation and
naming things. Its now about strings, and to duplicate arrays ... The stats
are skewed because hordes of beginners. Mainly driven by what schools teaches
and what languages has the most hype. That said Python _is_ huge . Damn you
significant white space.

~~~
sametmax
I often say that Python is the best at nothing, but pretty good at most
things. And hence it became huge by the sheer appeal of being versatile. Life
is short and most people needing to program are not programmers. Also many
programmers didn't start as such, and were simply looking for an easy way to
solve a task.

~~~
roenxi
There is a bit more insight to be found by reversing that - Python is simpler
than other programming languages and achieves that by sacrificing a little
power.

Compare it to C, which it has displaced as an introductory language. Python
and C are superficially interchangeable to a beginner, but to learn C you have
to invest time into pointers and memory management. Python sacrifices the
efficiency of direct memory management to avoid the complication of pointers.
Arguably, this is a significant benefit because it also cuts down on ways to
introduce bugs.

Compare it to a Lisp - Python has a pretty inferior set of basic capabilities
(can't even use a dict as a dict key, drives me mad), but that just means
there is only one easy way to do things that everyone uses. Less room to think
up clever ways of doing things, less complexity reading other's code.

Being the 'best' language for a task has a huge cost - incidental complexity
created by including specialist constructs. Python's success suggests maybe
programmers prefer this complexity to be encapsulated in a library rather than
the language core.

~~~
np_tedious
> can't even use a dict as a dict key

Curious, is this actually something you want to do often? While there is no
hashable+immutable frozendict ala frozenset, you could throw one together or
even define a hash function on a subclass and "swim at your own risk" not to
mutate it later.

I've encountered this enough with lists and the obvious solution is to cast
them to tuples. Can't say I've found the same with dicts tho.

As for the comparison with lisp - in most lisps this is a non issue because
nearly all structures are immutable

~~~
samatman
Several times, when working with Lua, I’ve made what I call “Janus tables”.

Give them a string, they return a table or function. Give them the table or
function, they return a string.

It’s a useful technique that you can only apply if your hashmap can map
anything to anything.

~~~
BurningFrog
[https://en.wikipedia.org/wiki/Bidirectional_map](https://en.wikipedia.org/wiki/Bidirectional_map)

Any hashmap will have problems with storing mutable objects, where the hash
value itself can change _after_ the object has been stored, causing some very
unwanted paradoxes.

And _that_ is the problem with Python dicts as keys.

~~~
marcianx
I don't think mutability is a concern if your goal is to get a bidi map
between strings and (mutable) _instances_; i.e. if you just want to use the
reference to the dict itself as the hash rather than the contents of the dict
itself.

~~~
BurningFrog
Yeah, I don't actually know if Python computes hashes for dicts by content or
"identity".

I just assumed it was the former, based on the fact that dicts are disallowed
as keys.

~~~
fiddlerwoaroof
It’s been a while, but I’m pretty sure the reason why a dictionary can’t have
a dictionary as it’s key is because the dictionary class doesn’t implement the
__hash__ method that would compute the hashcode.

~~~
np_tedious
This is definitely the proximate reason.

The reason for that choice is because the object is mutable.

~~~
fiddlerwoaroof
Sure, but as others have mentioned, you can make your own choice by
subclassing dict and defining your own hash function, as long as that function
is defined in a way that follows the appropriate rules.

------
ravenstine
Python's documentation is not the worst, but it's certainly nowhere near the
best.

As for JavaScript, these days I almost entirely rely on the MDN documentation
and hardly go to Stack Overflow for that topic.

~~~
MehdiHK
Came here to write this. MDN is a blessing.

------
inglor
I think a big part of it is how much canonical documentation and resources has
improved in JavaScript vs. how much people are struggling with it in Python
(as someone who does more Python than JS but does both).

Python libraries tend to have less documentation and their documentation tends
to be less live whereas JavaScript has been more stable lately (something I
didn't think I'd ever write).

Funnily enough the last time I really struggled with a JavaScript library's
docs it was Tensorflow.js (a Python port).

Also, I'd love to see a comparison that checks "all" JavaScripts
(+TypeScript).

~~~
inglor
Another thing I've noticed is that the Python community in StackOverflow is
very nice and considerate most of the time compared to the JavaScript crowd.
(Being a part of both).

If anyone is interested in engaging by the way:
[https://sopython.com/](https://sopython.com/)

~~~
scaryclam
This seems true of the Python community in general. I've yet to meet anyone
that's not nice and really supportive (there are bound to be some, but I've
not knowingly interacted with them).

I think it's a great measure of a programming language's ecosystem when taking
part in the community is such a pleasure.

~~~
whynotminot
From the beginning the language has taken great pains to be readable and
comprehensible. It makes sense that would breed a community that values
empathy.

~~~
inglor
That's a good point! Though I think a big part of it is that the web stack
changes a lot more often which breeds a lot of fear that kills empathy.

I've met some of the nicest people I know in the JavaScript open source
community and some of the most empathic though.

------
tinyhouse
I like Python and it's my main language currently after years of C++ and Java.
My main problem with Python is that it's really easy to create really messy
code that no one can follow. And I see it often because everyone is using
Python these days. For example, you have an undocumented function with 6
arguments and have no idea what these are (having bad names also doesn't help,
but that's not a Python specific issue).

Type hints and annotations are a step in the right direction. But the adoption
is still not high. That's the blessing and curse of Python - it supports many
good practices but it doesn't force you to use them so it really depends on
the programmer.

~~~
BurningFrog
I have my problems with Python, but I'm not aware of _any_ language where it's
not "really easy to create really messy code that no one can follow".

~~~
tinyhouse
True but take my function example. In Java for example you will have the types
to click on to figure out quickly what the arguments are. Another example? In
Python it's "easier" to make spaghetti code because of the scoping of
variables that are less strict. I can give many more examples like this.

------
aasasd
It just means that almost all trivial questions about JS have been asked and
answered, now it's Python's time.

\---

Also I bet that if each language's words were compared to the overall
vocabulary for SO, or at least to the cumulative one for these languages, the
differences would stand out more.

And of course, the usefulness of a word cloud visualization is highly dubious
to me.

~~~
sametmax
No if you see the questions, they are the same over and over, for js or
python. Simple things you can google, answered a 100 times.

------
acomjean
I’ve used python for a while but mainly for small scripts. I’m often googling
answers. (Is it myvar.len() or len(myvar) or myvar.__len__.?) do I use conda
or pip or... 2.7 or 3.?. Oddly I’ll use books for other languages
(Perl/JavaScript).

It’s a fine language and easy to get running but it seems harder to memorize
things in it vs others (if I was 100% of my time using it, it probably would
easier).

~~~
cableshaft
> ...it seems harder to memorize things in it vs others

This x10. I love Python, and use it for small scripts when I get the chance
(just used it to test some probabilities last night even), but it seems like I
constantly have to look things up all the time in it and can't seem to
remember even common, basic syntax in it, despite having used it quite a bit.
I really don't know why. I can leave and come back to other languages and not
have anywhere near as much difficulty.

~~~
acutesoftware
Interesting - I had the complete opposite experience: Python was the first
language I'd tried in a long time that just worked as I'd expected it to.
After understanding the initial indenting rules, most of the code I tried
could be written as pseudocode, which surprisingly worked the first time.

I was really impressed, most languages have so many stupid syntax
requirements, which really shouldn't be be needed these days - everything
compiles to the same assembler code so lets not pretend these languages are
doing magical things.

The goal should be for programmers to get the logic across to the computer in
the simplest form - and Python is pretty good for that (apart from zfil -
seriously, can you get any more unintuitive)

~~~
goatlover
> everything compiles to the same assembler code so lets not pretend these
> languages are doing magical things.

Nope. Some languages get compiled into binaries that are more performant with
a smaller footprint. Some have a runtime that provides features like garbage
collection and runtime evaluation. Others let you define macros that run at
compile time, extending the syntax of the language. Some are graphical live
environments. Others offer full high-level concurrency.

Languages have different syntaxes to support the features that their
interpreters or compilers can convert into the code that can run on the target
environment. This is not going to be the same across all languages, and there
are tradeoffs.

------
kissgyorgy
Is it happening because of Python getting more popular or getting more
complicated to use?

~~~
sametmax
15 years of Python here, started in 2.4. Day to day Python is not more
complicated to use. It's actually easier due to many bugs fixes, quality of
life features and better error messages.

However, Python does provide more tools to do more complicated things (async,
type hints, etc), but that's not what most people use. They actually don't
even know about it, and don't have to care. So it's not the questions you see
on SO.

Python has gotten much, MUCH more popular, and we are currently facing a wave
of new beginners. Particularly from schools (it's now the default teaching
language in most countries) and from loads of workers that can benefit from
manipulating data with programming and are attracted to Python for this.

It is precisely because Python is still easy that it's that popular: it
doesn't benefit from massive existing code bases like Java or accidental
monopoly like JS. We just have a lot of people creating a lot of libs for
pretty much everything, because everybody can do it.

I also think the aesthetic of the language plays a big role. Python has been
designed to allow you to dev with it with just MS notepad if you have to. It
means you don't need to learn about a gigantic and complicated ecosystem to be
productive with it (although it does exist): it's a huge help for all those
people that are just getting started or not a programmer at heart. It's also
harder to create very ugly code because you don't know what you are doing, and
if you do, the result will not be as bad as with other languages because Guido
made sure of it.

It's also why you don't get multi-line lambdas. Everything is a compromise.

~~~
skdotdan
I mostly agree with you, but still think that Python could be way simpler and
equally powerful. I'd love to see a language similar to Python, but with named
structs instead of classes, for instance.

~~~
typon
@dataclasses?

~~~
sametmax
People have not caught up with 3.5+ yet. I see plenty of code not using
f-strings, chainmaps, pools and the likes.

We can't expect them to known about dataclasses yet.

------
McDutchie
In this sort of context, "most questioned" is probably not much more than a
synonym for "most popular".

~~~
smt88
Couldn't disagree with you more.

"most questioned" is some combination of:

\- many beginners

\- incomplete or outdated documentation

\- not taught (or taught well) in schools

\- SO users who don't search for old answers before posting again

See how none of those things, even mixed together, are a good proxy for
popularity?

We don't know the mix of the above factors for Python, but without better
analysis, the headline here is meaningless outside of its specific claim.

~~~
jcelerier
> See how none of those things, even mixed together, are a good proxy for
> popularity?

I'd say that having many beginners alone is enough to qualify as "popularity".
There are more people learning programming that programmers.

~~~
smt88
I can't disagree with you because that's an issue of semantics. I would define
"popularity" as the number of people using the language, regardless of skill
level.

By that definition, I'd guess that Python is near the top due to its recent
dominance in data science, but Stack Overflow isn't proving or disproving the
idea either way.

Using my definition (and likely yours), JavaScript is certainly the most
popular. But it's hard to discount the many huge organizations using Java and
C#. Their beginners might not be using Stack Overflow as heavily because they
have in-house mentorship.

------
bjourne
Seem to me that Python has won. What I mean by that is that it is used almost
everywhere and there is almost no compelling reason to use anything else. You
want web? Django, plus a million other frameworks, all well tested and
documented. Machine learning? Tensorflow, Keras or PyTorch. Scientific
computing? Numpy.

For the last two decades people have complained about (C)Python not being
multi-threaded, not jitted, not having tco, being to simplistic and so on. In
practice it seem to have mattered very little. For the applications where it
do matter, like if you are writing your own language vm, compiler (but see
PyPy) or garbage collector, you have to ask "Yes, ok, but how often do you do
that?"

~~~
codr7
There are plenty of compelling reasons to use other languages. Macros, types,
threads, interfaces, lambdas, tail calls etc.

But what matters in this world is short term profit. Python is easy to get
started with, has a ton of frameworks than can be duct taped into semi-working
software by mostly anyone and is taught in many schools.

~~~
TelmoMenezes
The majority of the people in the world that can benefit from writing computer
programs for the most various purposes are not professionals, nor desire to
be.

Computation is a powerful tool wide incredibly wide applications, and Python
makes this tool accessible to humanity in general. That is no small thing.

Macros, types, threads, interfaces, lambdas, tail calls, etc. are incredibly
niche interests, and perfectly unnecessary for the vast majority of
computations that people would like to perform.

~~~
codr7
Sure thing.

Until the last paragraph.

There comes a point in every amateur programmer's evolution when learning
which way is up and picking more powerful tools is the right thing to do.

------
Animats
This may reflect the recent addition of features to Python that were not
really needed.

Another problem is "virtualenv". With more "version pinning" capability,
there's an increasing tendency for Python programs to require their own
special snowflake environment. I keep seeing install instructions which begin
"Install virtualenv".

Package authors then worry less about backwards compatibility. That's the sort
of thing that generates Stack Overflow questions of the form "Why isn't X
working with Y".

------
rossdavidh
My first thought on reading this was the guess that, while the questions about
Javascript are about fewer topics, the questions about Python are more
widespread (because it gets used for more different kinds of things). In other
words, if you looked at the volume of questions _read_, you might still see a
substantial lead for JS, but it's even more likely that your question has
already been asked (and answered) on SO, thus fewer new questions than for
python.

Just a guess, of course.

------
politician
I wonder if this is a combination of JavaScript frameworks becoming more
sophisticated and offloading concerns from developers and the sheer exhaustion
of trying to get a question answered from SO without the host of problems
involved in simply asking the question.

It's often easier to ask and answer your own question on the corresponding
Github issue tracker and let Google index it, then to run the SO moderation
gauntlet.

------
agumonkey
I find the term 'questioned' almost hilarious

------
_old_dude_
A lot of universities are now using Python at the beginning of their
curriculum, that may be one of the cause.

------
punnerud
The biggest Universities in Norway switched some years ago from Java to Python
as intro language. Think the Universities are a large driving force in the
long run.

------
seaghost
I think it's partly because a lot of academia use it and most of those people
are without formal CS degree which is completely fine.

------
m1117
That indicates how fast data science and ML are growing

------
itwy
And yet there isn't a proper Python to JavaScript transpiler, like
ClojureScript is to Clojure. I wonder why.

~~~
cutler
Yes, that always puzzled me. Same with Jython which has a much smaller
following than JRuby. I think with Clojurescript it's a case of really adding
value whereas Python to JS is largely syntactic sugar.

~~~
itwy
That actually makes sense (the difference between CLJS and syntactic sugar
transpilers).

------
wsdfsayy
Do questions about JavaScript libraries like React/Vue get included as
"JavaScript" questions?

------
alkonaut
Is typescript counted into the js category of questions?

------
desireco42
Of course, each noobie is confused about who to properly do things :)

------
stevemadere
As in: "Why on earth did you implement this in Python?" ;)

------
robertAngst
I'll take a stab at it.

Ask a question for (server) Javascript- 99% of people aren't going to try
because the code is too unruly to deal with. Its simply faster to google and
debug.

Ask a question in python- python code is simple enough to copy paste into SO.
And given python has hordes of newbies, they don't realize google is probably
a better place to look.

This synergy of situation is why Javascript is getting less questions.

EDIT: I program in both, I don't see why this is invalid.

