Live data from Hacker News

Python overtakes JavaScript as most questioned language on StackOverflow

globalapptesting.com

71–80 of 166 posts

Re: Python overtakes JavaScript as most questioned language on StackOverflow

#71

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)…

I think that the main problem is that novice programmers write python code just because they are domain experts since it’s quite easy to pick up. But sadly it’s not a kind of code that any seasoned programmer would write. It happened to me to reduce a >500 loc monstrosity to a rather manageable 50 or 20 loc or something like that...

Re: Python overtakes JavaScript as most questioned language on StackOverflow

#72
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.

Re: Python overtakes JavaScript as most questioned language on StackOverflow

#73

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)…

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".

Bingo. I’ve made disgusting messes of Java, JS, OCaml, C...

Re: Python overtakes JavaScript as most questioned language on StackOverflow

#74
post #46

Earlier quoted context omitted.

Hmm, this has not been my experience with Python libraries (I can't speak for JS ones). The vast majority are well-enough documented that I've never had a problem, and I strive to document my important libs at least this well: https://yeelight.readthedocs.io/

It always amazes me that the Python community is okay just missing indices for their API documentation. I’m so used to Rust [1], MDN [2], Apple [3], Qt [4] starting their docs off with great indices. Obviously, those are all “commercial” docs, but just indices alone is a huge help. To be clear, I think you’ve done an absolutely great job writing the prose — I just don’t get the cultural conventions around Readthedocs…

What do you mean by index? This is what I think of when I hear "index":

https://yeelight.readthedocs.io/en/latest/yeelight.html

Rust does the same, as far as I've seen (although the docs are a bit too index-heavy). Do you mean something different?

Re: Python overtakes JavaScript as most questioned language on StackOverflow

#75
post #31
post #26

Earlier quoted context omitted.

How would you want this to work? The alternatives to Sphinx I've used (Javadoc, Doxygen) more or less work the same way.

I think there's a big difference. Sphinx starts from the point of view that you're going to write your documentation as if you were writing a book, then on top of that it has some optional features for pulling in information from source files. Most of the others start from the view that you're autogenerating documentation from source-code comments, and on top of that there are some optional features for pulling in so…

Exactly on the money. I want to document my library, not create a website.

Re: Python overtakes JavaScript as most questioned language on StackOverflow

#76

Earlier quoted context omitted.

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.

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.

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.

Re: Python overtakes JavaScript as most questioned language on StackOverflow

#77

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)…

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".

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.

Re: Python overtakes JavaScript as most questioned language on StackOverflow

#78
post #22

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 incl…

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.

Re: Python overtakes JavaScript as most questioned language on StackOverflow

#79

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

Coming from Perl, Python library documentation makes me want to tear my eyes out. No I don’t want a cutesy fucking module homepage, I want reference documentation with some examples. Authoring PyDoc was the worst experience too. No I don’t want to install and configure a static site generator in order to have rich text documentation.

Some python documentation conventions are weird, to be sure. But I’d rather have an eternity of Sphinx build toolchains than the hell that is making POD/Perldoc work for medium-to-large projects (or small ones, for that matter).

Re: Python overtakes JavaScript as most questioned language on StackOverflow

#80
post #40

Earlier quoted context omitted.

Absolutely. For me it is a 50-50 chance whether I have data in a dict that needs to be mapped to something or have data in a list/tuple that needs mapping. Many major programming languages undersell how natural key-value data structures are; usually by providing unwieldy mapping data types. Clojure has spoiled me. > you could throw one together Yeah, I do. Most Python programmers wouldn't see a need for that, but tha…

> Most Python programmers wouldn't see a need for that, but that can be attributed to Python not having the capability by default and so they've just internalised not to use dict for anything that needs to be a key. You're being extremely uncharitable here. To a Python programmer "using a dict as a key" is a nonsensical idea for the same reason "using a list as a key" is — both dicts and lists are mutable. Python pro…

Good information, and well put. A small quibble: you should probably almost never use tuple(), even on recent Python:

    >>> tuple(dict(a=1, b=2).items())
    (('a', 1), ('b', 2))
    >>> tuple(dict(b=2, a=1).items())
    (('b', 2), ('a', 1))
Of course, if you can absolutely guarantee how the dictionary has been constructed, it is possible. No rules are absolute. But in my experience, frozenset() is probably better:

    >>> frozenset(dict(a=1, b=2).items())
    frozenset({('b', 2), ('a', 1)})
    >>> frozenset(dict(b=2, a=1).items())
    frozenset({('b', 2), ('a', 1)})
(Or sometimes even id(), as, if you are confident enough that the dictionary is identical, that might be because it came from the same place. If you are building a reverse dictionary, say, or a cache of indices. Though obviously that it is much more situationally dependent.)
Post reply on HN