Based on my reading of Should I flag a question as duplicate if it has received better answers?, it is my understanding I can ask a question here regarding a specific case of duplicate reversal.
python: create a “with” block on several context managers has been marked as a duplicate of How can I open multiple files using “with open” in Python?. I think the duplication link should be reversed, even though the question currently marked as duplicate was technically asked after the other question (2010 vs. 2009).
The main reason why is that interjay's accepted answer on the newer question is by far the most comprehensive of all the answers posted between the two questions. It provides vital information about both contextlib.ExitStack
, a backport of ExitStack
(!), and the problem with contextlib.nested
all in one answer. In particular, this vital detail about Exitstack
may be missed by those who go to the original instead (there is an answer about ExitStack in the older question, but it only has 6 upvotes, and is much newer, in fact having been posted by the person who eventually gold-tag badge unilaterally closed the newer question in November of 2018).
I'll also note the newer question is better: it is more generic and general because it asks about handling an arbitrary number of context managers, while the older question asks only about a known number of open
streams. Because the use of open
in with
blocks does not differ from other context managers, they are indeed duplicates in their subject material, but the newer question is phrased in a way that fits the exact subject matter better.
Edit:
I tried a mod flag to see what would happen. Here's the response I got:
helpful - This can be taken care of by community members and does not need moderator intervention.
It looks like reversing this is up to the community, or someone with a gold Python tag badge (or a combination of both).