-1

I'm perplexed about the relative merits of the three ways of getting a list of a dictionary's keys in Python. Obviously that is off topic for Stack Overflow because it is an opinion question (at least it is in part, there may also be factual differences in how the three results are calculated).

But looking at the tour I suspect this may not be the correct Stack Exchange site either.

Is there a Stack Exchange site for such questions, and if so, where?

| |
3

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.

| |

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .