Is it OK to ask on SO for help in explaining someone else's working piece of code, from Open Source projects or library examples etc.? Or does this belong somewhere else?
What is meta?
- Any Stack Exchange user can ask a question
- The community provides support, votes on ideas, and reports bugs
- Your voice helps shape the way Stack Exchange operates
I think it is OK as long as you are very specific. But if you throw up a hundred lines of code and say "what does this do" people aren't going to be happy. That's lazy and a surefire way to get downvotes.
Always give plenty of context - what is the project, what is this particular piece of code supposed to do. And describe what in particular you don't understand about the code. For example, if something is happening differently than you expect, explain why you are expecting something different. If they are using a strange syntax when you think something more common would be better, ask why someone would choose to do it that way.
If possible, narrow down the part you have a question about to a single code snippet that doesn't necessarily have anything to do with the library/project you're asking about.
The goal here is for you and others to learn how to be a better programmer, not to document the implementation details of an open source project. In many cases, when doing the above to formulate an interesting question, you will end up answering the question yourself.
Edit: You may also want to try out codereview.stackexchange.com, but I'm not active there and I don't if this is acceptable there or not.
Not sure why the downvote, but I've seen plenty of examples on SO where someone is asking what a piece of code is doing and, although I'm not hugely active on SO, have answered a couple myself. I don't see that there is any problem with it.
It would probably help if you make it clear that you've made a whole-hearted attempt at understanding it. Explain some of the research you've done, give an idea of what YOU think it might be doing, etc. Otherwise it'll look like "please splain to me teh codez", which is just spoonfeeding.