If I need to get something done quick, those sites will give me a quick 5 second refresher with clear examples.
Actually, in the doc you described as "obviously the correct hit", all I see is
> str.endswith(suffix[, start[, end]])
> Return True if the string ends with the specified suffix, otherwise return False. suffix can also be a tuple of suffixes to look for. With optional start, test beginning at that position. With optional end, stop comparing at that position.
Meanwhile, the first hit in Google for me is Programiz, which has actual real examples without any additional clicking around or trying to understand how the information is structured.
Besides, I know the docs exist, I don't need a google search for it. I'll click on the content farms every time because they've consistently been the fastest way for me to get what I need.
Many are asking questions about the Python Documentation How To Check Null Python 2023. Here are some solutions to How To Check Null Python 2023:
<ADVERTISEMENT>
Solution 1: Type "if variable is None"
<ADVERTISEMENT>
The first solution out of many is to type "if variable is None". This is the best way to solve Python issues, recommended by experts.
<ADVERTISEMENT>
Solution 2: Download Windows Computer Cleaner
Is missing :
We all know we should do the following, it's much clearer.
# Example of a dictionary to check None
> # Assign None to a variable
> myvar = None
> # Declare dictionary to check None
> mydictionary = {None: 'None is stored in this variable'}
> print(mydictionary[myvar])
If I expected something, I would try it.
Thankfully most of the reference documentation I have to look up are the popular data science libraries like pandas. Their documentation[2] is so much cleaner than core Python.
1: https://devdocs.io/python~3.11/ 2: https://pandas.pydata.org/docs/reference/index.html#api
These days for obscure terms, you don't even get the luxury of reading garbage written by people who barely understand the topic at hand, instead you get meaningless fluff generated en masse using LLMs.
Honestly, I'd rather spend time parsing whatever doxygen spits out than try to figure out what the needlessly verbose yet inaccurate LLM output is trying to get at.
But if you use Pandas, Numpy, Scipy, etc., you know how fantastic the official docs are. They are much better than content farm crap. And, yet, in these cases, too, Google ranks those sites higher.
I use DDG a lot more, and it has almost replaced Google for me.
I use Google now only for local uses- gas stations near me, restaurants near me, and so on.
I also highly encourage you to try code.you.com and phind.com. I have been very happy with them.
>> str.endswith(suffix[, start[, end]])
>> Return True if the string ends with the specified suffix, otherwise return False. suffix can also be a tuple of suffixes to look for. With optional start, test beginning at that position. With optional end, stop comparing at that position.
> Meanwhile, the first hit in Google for me is Programiz, which has actual real examples without any additional clicking around or trying to understand how the information is structured.
I'm sorry, but what examples could you possibly want that the official documentation doesn't make clear? It's written as concisely as can be, describing the possible inputs and the expected outputs of the particular function, no? I don't see how sifting through tens of lines explaining what the docs say in two short sentences is preferable.
When you get good at it, it is much easier to skim through 10 lines of fluff to find the answer (that is usually visually distinguished in a code block) then it is to parse through 4 really dense, terminology filled sentences.
If I need to know exactly how all the options work, sure the docs are the place to go, but 90% of the time I just need a quick example to go off of.
> If I need to know exactly how all the options work, sure the docs are the place to go, but 90% of the time I just need a quick example to go off of.
You will almost never get to the point where you'd need to know "exactly how all the options work" because if your routine is "search example, copy example, continue", you won't even know what options exist and that there is a way you could do things different (maybe more efficient? simpler?).
However, the PHP docs, especially for older, less-used functions, are riddled with subtle errors and inconsistencies related to the typing of arguments and handling of edge cases. But the way they're structured is fine! I particularly enjoy how you can type php.net/sprintf and land directly on the doc page you're looking for.
Any? Any example would do.
For any sufficiently complex function that requires me to actually look up the docs, I want example usage. Not all arguments are obvious. Not all return types are obvious. This is especially bad for overloaded functions. Worse is when docs requires a circular graph traversal of clicking endless links to more documentation.
Needless to say, I prefer content farms and blogs to the official docs.
> > str.endswith(suffix[, start[, end]])
> > Return True if the string ends with the specified suffix, otherwise return False. suffix can also be a tuple of suffixes to look for. With optional start, test beginning at that position. With optional end, stop comparing at that position.
What exactly don't you understand from that concise and official documentation?
The bottom line being that there is nothing you can do about it unless Python themselves fundamentally change how the documentation is structured, which I doubt they have plans to do.
I think that could mostly be done in an automated fashion to start. Then into the master doc you can start adding hinting and extra material that gets rendered into the sub-pages. So it could be approached gradually.
I'm honestly surprised Google employees haven't fixed this somehow, surely they have thousands of people running into this problem daily.
Why?
Google is an ad company, that has integrated search.
Why would they cut their own bottom line in order to make data happy?
You aren’t their customer. You are Google’s data. Google’s customers buy your data.
Why would they change anything about their business model, which works amazingly well?
AFAIK, Google doesn’t sell user data.
They can coast for an indeterminate amount of time, but with the risk that eventually the consumer will be fed up and stop using them, especially if a decent alternative pops up.
Google’s business model is selling user data to the highest bidder. Google’s other business model is selling opportunity to collect data on people.
You as a search user are not a customer, but a data point.
There is literally no incentive for this to change.
Desiring an ad company to not show ads is a ridiculous desire.
At the same time google coordinates with their other customer and swaps the time and eyeballs for money.
But users are definitely a customer paying with time in return for search results.
If the product becomes too obnoxious, people don’t even need an alternative to quit. It’s happened with other products. Not everyone will quit, but the customer base will shrink.
Google’s data gathering isn’t just search.
Anyone not using Firefox, and even those who are using Firefox, is gifting Google data.
That data is worth more than search results or search data.
Google knows where you browse. Google knows how many clicks, scrolls, and keys pressed. Google knows what your email contents and preferences.
Search is a tiny portion of Google’s data collection behemoth and whether users quit Google search for bingo search doesn’t matter much to them.
Like I said, Python or any other language can fix this issue by changing the entire mindset of how documentation is built. You can then get the OSS community involved on GitHub to slam dunk on all the SEO spammers.
Just look at MDN or Web.dev, both have their content repos up on GitHub and people contribute metric tons of useful info. And both of these sites have healthy standings in the context of SEO.
Can’t remember the last time I visited W3S/GFG to be honest.
It’s about to get worse though as it appears that DigitalOcean is putting a nail in the coffin for CSS-Tricks and Google will absolutely demote it because of inactivity, only the most linked-to pages will survive until DO decides to shit the bed and try and move the entire site to their Tutorials platform.
Please, please, I beg of you, in the name of all that is holy, do not push for SEO bloat in documentation!
Certainly some of the Python queries could return a card promoting a result from python.org just like other queries return a card promoting wikipedia.org
Google search rank has been an ML driven algorithm for ages now and take into account dozens of signals. User rejection (how fast people come back to the search from a result click) and obviously which results get clicked more often are examples of that.
Based on other comments saying they like the sites I consider spammy, maybe the weights aren't even wrong, they're just not optimized for me!
Who, exactly? A professional Python programmer probably has their IDE/editor set up so it can shows a brief document for `str.endswith` already. Someone who is new to Python (probably not even a programmer yet) might actually prefer the hand-holding from those content farm pages.
Someone who has been exposed to the most basic Python features and knows they want info on str.endswith can just type help(str.endswith) in the Python interactive environment.
None of that is going to be given either in an IDE or from help().
Also, who'd actually want hand-holding from low quality content?
That is what Google is doing! But remember, the advertiser is the user, not the person running the search.
If you want to be the user, and get good search, pay for kagi.
- a stackoverflow answer that has a useful example: https://stackoverflow.com/a/18351977/
- the Python documentation: https://docs.python.org/3/library/stdtypes.html
- Pandas documentation (they also have an endswith): https://pandas.pydata.org/docs/reference/api/pandas.Series.s...
- a blog post on Python regular expressions (this looks useful but is a wrong result for this query): https://www.johndcook.com/blog/python_regex/
- something that could be a content farm with rephrased Python documentation: https://pythontic.com/concepts/string/introduction
The top three results are good, and I guess it's a matter of taste whether the succinct Stackoverflow answer is better than the verbose official documentation.
We've come full circle.
Nor should they, in my opinion. Quality of documentation is more important than that.
Google's ENTIRE JOB is to surface the CORRECT content for a query. If they are objectively not doing that, then they are in the wrong. Imagine credit card fraud just kept increasing, and instead of adapting and improving their systems, companies just threw up their hands and said "deal with it, not our problem, nothing we can do" as you had to generate a new credit card number every other day because even the most trivial card number enumeration attacks were not stopped.
The fact that google is completely unwilling to change how they operate to prevent even the simplest, intern driven SEO trash from overtaking literally authoritative sources should be exhibit A in a trial to break up Google, as evidence of how negative value they are to the consumer.
It's the rough equivalent of Fedex just throwing away a third of the packages they are supposed to deliver at random, and people seemingly just saying "eh, nothing can be done"
Google's job is to serve ads profitably. It's something like 90% of their profit (80% of revenue). To some extent they even have an incentive to show poorer results first because it makes you stay on the page longer and look at more sites (more ad impressions).
And then it hits me: the proper documentation for things are on pages without ads! Perhaps that’s the signal google needs to start weighing heaviest…? ;)
Its entire purpose is to inject itself as a search middleman. Even worse, I find myself landing there from google results to a question they had closed as not worthy of the site, but worthy enough still to keep up for the search juice.
Well, you did google for the question and not for the answer. ;)
This is an irrelevant distraction, because Google's literal army of nearly 200,000 full time employees, a large number of whom are Python developers, do know. Geeksforgeeks, w3schools, programiz, tutorialspoint, and python-reference.readthedocs, which all rank higher than the official documentation, are not flash-in-the-pan sites. They've been polluting the search results for literally years. Trivial manual processes at Google scale would be 1000% fine and effective.
Google could, if it gave half a shit, give every employee a Chrome browser extension that lets them manually vote on the reasonability of site rankings within known problem genres for their own searches.
Like I never ever ever click on a web ad, and can't even remember the brand it was about 3 seconds after leaving the page, whenever I see G4G, TP, etc., I never ever ever click them. At this point, I think this doesn't even reach my brain, but is handled by my spinal chord.
For what it's worth, the ads aren't for you. They're for anybody or anything that might click them, knowingly or not, and that's not you.
Is monetising the web through advertising the reason these scraper sites exist? And removing that would make scraping sites an expense with costs rather than profits?
Perhaps google could do this. Ads on third party sites are probably a small part of their income compared to sponsored ads in search results, so they could be sacrificed and they’d take down their competitors who rely more on the website ads because they don’t have the search?
However, they have no need to compete on search quality at this time. If another player in the search and browser wars started downweighimg ad heavy sites then this might make google have to reluctantly follow suit. But you can imagine the FUD campaigns to paint such an actor as killing the internet and being the bad guy etc…
I suspect if there were separate pages for each type then it would be ranked higher... and it would actually be more useful. I don't get why they've done it like that.
The higher ranked pages admittedly have a whole page just for a single method, which is too far in the other extreme and is obviously more for SEO than use. But with the Python docs the way they are, we'll never know whether a more sensible official page would beat them or not.
As some evidence that it's not just Google allowing spammers to shine through - sometimes for a search about a built-in type I actually do get official docs at the top, but it turns out to be the tutorial page about the class (which is not a giant mish-mash).
If someone simply took Google and just applied a huge blocklist so that garbage sites like those never got indexed, it would be the perfect search engine.
> Return True if the string ends with the specified suffix, otherwise return False. suffix can also be a tuple of suffixes to look for. With optional start, test beginning at that position. With optional end, stop comparing at that position.
... without an example is NOT easier to use than an example for people learning Python. It uses language specific jargon (suffix, tuple), unexpected capitalization, and is needlessly terse.
How about ...
> Check if a string ends with a certain ending (or endings) and return True if it does, or False if it doesn't. You can specify one ending or multiple endings in a tuple. You can also choose where to start and stop checking within the string.
.. along with an example of code that can be easily copied? That is the value the other sites provide. Readability and usability.
Which is why LLMs have Google scared, in my view.
If an LLM has all the answers, you don't need to hand over your question to Google so it can steer you to the "right" (ad-filled) answers. It just knows, and tells you. Yes, hallucinations are still a problem but they aren't a growing one. LLMs that can provide you a reference to the right docs will be a thing soon if they aren't already.
How does Google make money in a world where fewer and fewer people need to ask them for where to find the answer?
I know this doesn't answer your question, but I hope this helps you in the interim.
https://kagi.com/search?q=python+endswith&r=us&sh=XzO6gCg6CO...
Google:
https://www.google.com/search?q=python+endswith
Bing:
https://www.bing.com/search?q=python+endswith
In general, in search you get what you pay for.
Google needs that sweet surveillance money so its results are filled with crappy content farms both human- and LLM-generated. Kagi doesn't need to make money so it can happily link to the highest quality sites, even if they don't take part in the targeted advertising economy.
You don't have to parse through a veritable novel of irrelevant results to find what you're looking for.
They provide example code to show you how to use the method.
They break down the usage more thoroughly than the official docs.
They _show_ you the different parameters you could pass to the method.
Some of them provide interactive REPLs where you can play with and test the method.
The docs break it down _technically_ but they leave questions. Are start/end inclusive? What does it mean to "stop comparing at that position"? Why would you use the start parameter if you're trying to find the end of the string? If you use start does the end parameter count from 0 or from start? What happens if you pass a start or end that are outside the bounds of the string?
Look, I think the Python docs are great and use them all the time. But for the average person looking for info on `endswith` - whether that's someone new trying to understand how it works, or someone experienced looking to understand the parameter types - those pages are more approachable.
"This function accepts the following arguments, half of them are documented below. It also accepts kwargs, but we won't tell you what to put in there or where it ends up. To keep you on your toes, we throw some special mystery exceptions that we won't tell you about. Do they have a common base? It's a secret. Have fun digging in the source code like a chump; Python is easy to read, you'll figure it out."
Not to mention that there aren't any overarching standards like JavaDoc. There was a PEP a while back describing ReST with some inconsistent examples of how to use it to document code. Most projects I've seen pick one of the competing standards, half-ass and inconsistently follow it, then rely just on examples to document usage. It's a mixed up hodgepodge of incomplete prose that's difficult to read with a machine.
The "You're not the customer"-perspective: You as a user of google search is not the customer. The customer is the people placing ads on Google search, and secondary the people placing ads on the pages google search leads users to.
The "its an algorithm"-perspective: Google is a search engine, not a collection of curated links. In the past, Google has been very much against having human rate results, but I think they actual have focus groups that come in a lab and do some searches and rates what they see (under the guise of being a different search engine, most likely). Google is very conservative about adjusting their algorithm (or at least have been) and small changes can lead to huge changes in income.
But more seriously... I think it's because the language and framing of the python documentation is difficult for a new user to understand.
Yes, Python is miles better than some other languages at documentation, but it's still more of a reference than a tutorial. I remember when I first started learning Python, I read blog entries (e.g. blogspam) more than I did the official docs.
In my intermediate phase, I searched Python docs but I didn't need Google's help for that.
Then I realised StackOverflow has ads nowadays and my search offering would be useless for like 98% of devs.
https://docs.python.org/3/search.html?q=endswith
Otherwise I really like ChatGPT like this: you put in minimal work into the query and it usually fills in useful info. If you use "Advanced Data Analysis" mode it will run those examples in the browser.
MDN would, I suppose, be a more authoritative source on what Mozilla thinks. And, presumably, a less authoritative source on what everyone else thinks.
The principle difference as far as I can see is that w3schools gives me the same information in 3 pages instead of 10.
My suspicion is that google cares less about what you think, and more about what everyone else thinks.
Additionally Google guidelines for search ranking prioritize meaningless fluff and spam because they want to waste as much of your time as possible. More wasted time = more ad exposure.
The worlds largest search engine is owned by the worlds largest advertising company. I am surprised no one saw this coming lol
Long answer: Balancing the many interests of search result parties, the decrease of consumer satisfaction is by Googles benchmarks outweigh by money received from their paying customers.
Use Bing, results are relevant and they do not yet rank paying farms as number one.
However, the api library reference is only one kind of documentation, and not necessarily what everyone is looking for. For whatever language I'm working in, I keep the library docs handy for immediate use, and only go to search the web when I'm looking for something beyond a dry reference. Maybe I want a tutorial, or short how-to for a specific task. Maybe I'm looking for something deeper, with context and explanation.
I somewhat agree with another comment here: the library reference docs should be a keystroke or click away in your development environment. Are there plugins for your preferred editor or IDE to make this possible? Use those. If you're looking for a different kind of documentation and it's not part on the official python site, maybe that's something to be addressed.
Just because it's official, doesn't mean it's good documentation. The other results are significant better for this specific query. They are more elaborated, have better readability, offer examples, and don't force you to search through a long text to find the 3 lines which are relevant for you. Some even have a live-test.
The only real benefit python.org offers here is to offer more documentation about the language itself. Which is interesting for beginners, but not necessarily for everyone else.
Google isn't built with the end users in mind. It's built to exploit people, and sell that onto their actual customers, the advertisers.
https://www.google.com/search?q=site%3Adocs.python.org+%s
then you can type something like `py endswith` in the address bar. Or use ddg's "I'm feeling lucky" (prefix the query with !) and go directly to the first result: https://duckduckgo.com/?q=!+site%3Adocs.python.org+%s
Even better, just use https://devdocs.io/My guess would be that engineers first go to documentation, don't understand it, go to low-quality-content-farms which answer their questions in natural language. It's low quality but it's enough for novice use cases such as python endsWith.
And this leads to a big reduction in Google's ranking of python docs.
TLDR : most novice programmers don't/can't read docs.
The docs are written by and for experienced programmers. They're very dense with information but light on examples and comments that explain things for dummies.
Its popularity means the vast majority of Python users are novices who would find the docs hard to read. Geeksforgeeks et al are providing content for them and so is actually a better resource to show the majority of searchers (especially given that it's a basic string formatting question, something very likely to be searched by for novices).
Invest in good code editor with linting. No more googling for such trivial things
I suspect that someone who needs to know that their developer experience is broken probably doesn't know what "DX" means.
But seriously, try the same search query with some LLM, you will get description and code example. Add usecase and it will fit it into example.
I get why at least with the python docs, they're a little dense. some of those others have example uses which I could imagine people find useful.
geeksforgeeks with the login nag page is pretty bad.
DuckDuckGo is a bit better than Google at avoiding content farms and semantic web spam, but I think it's mostly for the same reason Linux and MacOS used to have zero malware.
It retains that early-2000s Google vibe, where there were still quirky independent sites to discover. Using it also surfaces just how much Google is censoring its own results on controversial topics.
1: docs.python.org › 3 › library › stdtypes.html
2: pandas.pydata.org › pandas-docs › stable › reference › api
3: This discussion!
I've tried DDG and Brave for a few weeks each, and gone back to them once in a while when Google search has completely failed for things I know exist. They mostly have worse results than Google (purely in terms of relevance of the first page), and Google is trash now. I'll give Kagi a try for a few more days and see, but maybe the web has finally got to the point where paying for search is a useful strategy.
It's extremely bad.
You can see for yourself.
As I mentioned in another comment, Phind and You Code have been quite good as well.
Obviously I'm not saying they're singling out python or documentation in general as some kind of cash cow. More realistically the story is that, sites that serve ads make money, and can spend money on cat-and-mousing SEO to keep making more money. Technical docs aren't going to do that. Google could whitelist them but it seems they turn a blind eye for the aforementioned reason.