Live data from Hacker News

Python overtakes JavaScript as most questioned language on StackOverflow

globalapptesting.com

121–130 of 166 posts

Re: Python overtakes JavaScript as most questioned language on StackOverflow

#121
post #104

Earlier quoted context omitted.

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.

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

[deleted]

Re: Python overtakes JavaScript as most questioned language on StackOverflow

#122

Earlier quoted context omitted.

> and there is seemingly no other way to discover what that is Yes there is, it's called reading a goddamn book. > Knowing the right thing to do requires you be informed about the history of Python language design Bullshit, it requires you knowing the language. Perhaps by reading a book. Knowing the history is of little value. > sifting through the massive corpous of documentation and historical knowledge required to…

1990 is calling and wants you back... But seriously, many of us simply don't remember that sort of book learning. If it comes to you naturally, fine, just realise that people are different and have different skills, memorization techniques and care about different things. Some programmers are like you (a tiny minority afaik) and can read a dry spec or a book and remember all the intricacies and gotchas. It takes a ce…

> many of us simply don't remember that sort of book learning.

You mean you haven't heard of books, or can't read, or can't be bothered? Presumably none of these so what are you saying?

> just realise that people are different and have different skills, memorization techniques

Fine, I agree totally, use those! But here's what the original poster said "generally accepted best way to perform this operation that leverages the standard library and there is seemingly no other way to discover what that is". If you can find the answer on SO, that's fine - you have your answer! But that's not what he said. He said there's no way of finding it. I said it's in books, you say it's on SO, so there clearly is.

> Some programmers are like you and can read a dry spec or a book and remember all the intricacies and gotchas

Which I can't and don't. Please re-read my penultimate sentence where I said it's ok not to, nor was there need to. Kind of twice in fact ("You're there to deliver results correctly to the business, not deliver idiomatically perfect code." -and- "There's NO shame in not crawling into the furthest, darkest corners of a language.")

> And I would note that none of the people I knew who could do that were particularly good programmers

Oh noes, I haz been trolled :)

> Now most programming languages don't,

No language I've ever used ships with a tutorial (oh wait, delphi's did. Rather crap but it was there). Python's online docs are ok (not great, ok). So pick a book. I already recommended one. Reading is the same whether it comes from paper or phosphor. Just don't complain it needs work. It does. Sorry.

From experience: not knowing how your tools work is a recipe for vastly increasing your workload. Reading a book is a boring, tedious shag but will give you the greatest savings of time overall.

> learn by making, experimenting and adapting examples

Yup, that too. Books AND that. You're quite right. I should not have overlooked that.

Re: Python overtakes JavaScript as most questioned language on StackOverflow

#123
post #87

Earlier quoted context omitted.

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?

Maybe they mean something more like this page https://yeelight.readthedocs.io/en/latest/genindex.html which your Sphinx setup appears to be generating but the theme doesn't seem to be linking to.

This is exactly what I was thinking of.

Thanks for pointing this out, and thanks to Stavros for promptly engaging too :-)

Re: Python overtakes JavaScript as most questioned language on StackOverflow

#124
post #98
post #3

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.

I'm sure there's lots of beginners to programming but most of the time when I find myself asking basic questions like "how to duplicate array Python" isn't because I couldn't spend 2 minutes writing a function to do it but because there already exists a generally accepted best way to perform this operation that leverages the standard library and there is seemingly no other way to discover what that is. Like for this…

The best way to perform a specific action can sometimes change depending on what method is currently fastest. Copy, slice, instancing a new list object, the copy module, each can have their own code base. It would not be surprise me at all if which one is the fastest method has shifted several times between 2.7 and latest version.

That said, copying is in this case the end result of distinct different methods. In the stackoverflow answer, the only redundant way to copy is the .copy method list has. If I understand right it is just a convenient method in order so new programmers don't need to import the copy module.

list() is a common way to create a new list, and the constructor can take a initial sequence. Lists are sequences, so list can take a list, but that is just a side effect.

Slicing is very useful for taking the first or last objects of a list. if you take all the first and all the last objects, you get a copy. Its not the primary function of slicing, but a useful side effect.

The copy module is a lower level interface to work with python objects. As any other lower level interface it mostly used in exception cases when you really want a "deep copy". I have used that trick once in my whole programming career, and it was to work around a restriction in a third-party module for a corner case which they clearly didn't consider.

Re: Python overtakes JavaScript as most questioned language on StackOverflow

#125
post #82
post #46

Earlier quoted context omitted.

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…

MDN is a wiki though, run by a nonprofit and written by the community.

Yes, but it’s backed by enough interests and money that it’s still not fair to compare to a typical FOSS or hobby project :p

Re: Python overtakes JavaScript as most questioned language on StackOverflow

#127
post #17

Earlier quoted context omitted.

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

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

> Can't say I've found the same with dicts tho

I would think a NamedTuple would do the trick? (https://docs.python.org/3/library/collections.html#collectio...)

Re: Python overtakes JavaScript as most questioned language on StackOverflow

#129
post #78

Earlier quoted context omitted.

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

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

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.

Re: Python overtakes JavaScript as most questioned language on StackOverflow

#130

Earlier quoted context omitted.

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

id(dictionary) is the key you want: immutable, reliable, cheap.

That value will not change when the contents of the dict are updated. You’re keying on the dict itself rather than the hashed contents. That’s what you want in some situations, but it’s not what the parent post is looking for.
Post reply on HN