Pythonではファイルを開くときなどにwithを使うのが定石である(参考:ファイル - Dive Into Python 3 日本語版)。しかし、複数のファイルを開くときには以下のようにネストが発生してしまうのが気に入らなかった。
with open('a.txt', 'w') as f1: with open('b.txt', 'w') as f2: # 処理
Multiple variables in Python 'with' statement - Stack Overflow によると、以下のコードでネストを回避できる。Python 2.7とPython 3.1以降で利用可能らしい。
with open('a.txt', 'w') as f1, open('b.txt', 'w') as f2: # 処理