A factual question about these methods could be on topic for Stack Overflow. I.e. a question that asks what these methods are and how they differ, but not which one should be preferred “in general”. Such a question wouldn't be opinion-based, but it might be too broad.
It definitely isn't a design-level question or a question about software engineering. On the other hand, some questions that ask about the design of programming languages have been successful here. Unfortunately, questions that ask about the “why” are not answerable except by the language designers.
For both SO and here, it can be helpful to focus your questions on the actual problem you are trying to solve. Questions that are asked out of curiosity or that actually intend to start a discussion are much more difficult to ask well. E.g. a question about the problem “I'm trying to create a dictionary class from scratch – how do I have to implement key access in order to be compatible with dict
?” is very answerable and a good fit for SO. Sometimes, a problem like “I don't understand why it is designed that way” can be sharpened into an answerable problem, e.g. “under which circumstances is it necessary to use dict.keys()
when k in dict
/iter(dict)
work as well?”. Again, that would be a better fit for SO.