But where Google fails and other search engine is to show results that are relevant to the user.
As some comments have said here for the query "python throw exception" some people want to get the official python doc when others want a snippet and when other want a tutorial, and some want other things. The fact that there is only one first result and it is the same for everyone IS the issue.
In my personal experience Google works very well for code queries much better than any queries on SEO topics