Parenthesized context managers — Previously parenthesized context managers throws an error >>> with (open("test_file1.txt", "w") as test, open("test_file2.txt", "w") as test2): pass
File "<input>", line 1 with (open("test_file1.txt", "w") as test, ^ SyntaxError: invalid syntax In python 3.10 you can use it with parenthesis with no error, so code above will work. Structural Pattern Matching