4 ms·
> And I know the reason - ads and SEO. Wrong! At least in the case of Python. The main reason Python search results are so bad is that the official documentati
by IshKebab 3y ago
> And I know the reason - ads and SEO.
Wrong! At least in the case of Python. The main reason Python search results are so bad is that the official documentation is really badly organised. People literally can't find the answers they want there because everything is on one mega-page with a bunch of unrelated concepts. So Google ranks it badly.
The author's example ("python iterate over dictionary") is a good one. I tried that search - doc.python.org is NOT IN THE RESULTS (at least for the first 3 pages).
It's not hard to see why - the closest answer I could find is here:
https://docs.python.org/3/tutorial/datastructures.html#looping-techniques https://docs.python.org/3/tutorial/datastructures.html#loopi...
but it's on a page that also talks about lists, tuples, assignment expressions, nested list comprehensions, etc. No wonder people don't want to read all that!
And it doesn't even answer the question what `for x in somedict:` does - for that you have to go to this mega-page:
https://docs.python.org/3/library/stdtypes.html#typesmapping https://docs.python.org/3/library/stdtypes.html#typesmapping
and see that `iter()` is "a shortcut for iter(d.keys())".
Compare it to Rust "rust iterate over hashmap".
The 4th result is https://doc.rust-lang.org/std/collections/struct.HashMap.html https://doc.rust-lang.org/std/collections/struct.HashMap.htm...
It's just about hashmaps. The example at the top has iteration over one.