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)…
Python overtakes JavaScript as most questioned language on StackOverflow
71–80 of 166 posts
Re: Python overtakes JavaScript as most questioned language on StackOverflow
#72Just a guess, of course.
Re: Python overtakes JavaScript as most questioned language on StackOverflow
#73I 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".
Re: Python overtakes JavaScript as most questioned language on StackOverflow
#74Earlier 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…
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
#75Earlier 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…
Re: Python overtakes JavaScript as most questioned language on StackOverflow
#76Earlier 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.
Re: Python overtakes JavaScript as most questioned language on StackOverflow
#77I 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".
Re: Python overtakes JavaScript as most questioned language on StackOverflow
#78Gah, 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…
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
#79Is 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.
Re: Python overtakes JavaScript as most questioned language on StackOverflow
#80Earlier 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…
>>> 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.)