Author eric.smith
Recipients benjamin.peterson, berker.peksag, eric.smith, mjpieters, python-dev, r.david.murray, vajrasky, vstinner
Date 2015-01-05.08:29:14
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <>
Not that I think it's worth changing for this case, but I find code like this better written as:

if some_test:
    fl = contextlib.closing(open(sys.argv[1]))
    fl = sys.stdin
with fl as fl:

This way you don't need another test, the close isn't far away from the open, and you save some lines of boilerplate.

Or, if "with fl as fl" bothers you:

with sys.stdout if some_test else contextlib.closing(open(sys.argv[1])) as fl:

I don't recommend that, though.

In any event, thanks for the fix!
Date User Action Args
2015-01-05 08:29:14eric.smithsetrecipients: + eric.smith, mjpieters, vstinner, benjamin.peterson, r.david.murray, python-dev, berker.peksag, vajrasky
2015-01-05 08:29:14eric.smithsetmessageid: <>
2015-01-05 08:29:14eric.smithlinkissue18644 messages
2015-01-05 08:29:14eric.smithcreate