The the first page of results are from, in order:
mygreatlearning.com
udacity.com
geeksforgeeks.org
stackoverflow.com
w3schools.com
micropyramid.com
edureka.co
pythonmorsels.com
tutorialspoint.com
pythontutorial.net
Some of these resources are alright, but none of them are python.org or other primary source. As a python user and google expert, I know how to tweak my query to get better results, but if I was a novice I wouldn't.On the other hand, if I went to the python community discord server, I'd probably get a sensible response from a real human in seconds. (the python discord is particularly excellent, by the way)
www.w3schools.com
stackoverflow.com
docs.python.org
and a sidebar quoting the 2nd result which is the top voted answer to: "What is __init__.py for" on Stackoverflow.Google is in a sad state it seems.
The returned sites do?
If I google "php __construct" I get php documentation as the first result.
Google knows when someone doesn't find the answer they're looking for from a result, I suspect the results you're seeing are the ones the majority of searchers for that query wanted.
def __init__(self):
self.data = []
> When a class defines an __init__() method, class instantiation automatically invokes __init__() for the newly created class instance. So in this example, a new, initialized instance can be obtained by: x = MyClass()
Seems like a good explanation to me? Maybe people are upset that it's buried a bit in the docs instead of having a tiny out of context statement about it?I would guess google A/B tested those results till python.org fell off the front page.
More to the point, I don't think either google or the people searching are wrong for that. The query isn't "teach me about python classes" it's "what is python __init__?".
I know that it doesn't have to be either a long explanation or a quick and concise snippet of information, it can be both. But I find that a lot of docs will either have long explanations or short snippets (because time is finite and doing both is duplicating efforts), and in those cases, I prefer the long explanation.