This issue has been discussed in the past: Why was a purely programming-related question not moved/closed?
But I disagree with Andrea Corbellini
because I believe that the question Emit signal for GIO.DBusProxy in Python? is completely on topic, because it asks something related to the Ubuntu system, specifically to the DBus service.
What I propose, is to close questions that should be on Stack Overflow. The questioners should be informed (from a comment I suppose) that programming questions unrelated with the Ubuntu System are considered off topic and be given a link to SO.
Let me give some examples on what in my opinion should be considered on topic and what should be considered off topic:
On Topic
Bash Questions
Bash is the default shell on Ubuntu. Shell scripting is an integral part of managing a Linux system. I believe that all bash related questions are on-topic, even the ones that have to do clearly with programming tasks like how to add 1 to a variable.
However, this should be limited to users of Ubuntu or its derivatives
Any related to the Ubuntu System
Regardless the language the questioner uses, questions related with the Ubuntu System should be considered on-topic. It is not that hard to differentiate programming questions that have a direct connection with the Ubuntu system and those that do not.
Generally, if a question can be answered by a user that only has Windows experience and he has no idea what Linux is but also has experience of the language the questioner uses, then it has to be considered off topic. I think this is a very good general rule as it proves that if a user without linux knowledge can answer a programming question without to have to do some research first, then the question has nothing to do with Ubuntu, clearly.
Let me give some examples here:
When reading a text file, how to get rid of "\n" when extracted in python | https://askubuntu.com/questions/482777/how-to-remove-a-space-from-a-string-in-python | How to block certain characters from a string in Python - Off topic. It has nothing to do with the Ubuntu System. The questioner clearly needs python knowledge in order to solve his problems.
How to convert a .glade file to a .py file | Gtk3+ keyboard shortcuts without signal matching - On topic. It has to do with Ubuntu System as it refers to Gtk.
What is the correct way to use the "scroll-event" signal (on an indicator) for Qt? - On topic. It has to do with the indicators, clearly part of the Ubuntu system.
What is the correct way to use g_signal_connect() in C++ for dynamic unity quicklists? - On topic. It has to do with Unity integration of the application.
Off Topic
Any other programming question
Please inform me if there are questions that do not fall in either category. Personally, I believe that if we follow the "windows user rule" then there will be no frustration.