This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author ezio.melotti
Recipients Marc.Abramowitz, alex, barry, belopolsky, ezio.melotti, ncoghlan, nikratio, pitrou, python-dev, rhettinger, vajrasky, vstinner
Date 2013-10-11.01:40:48
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1381455648.99.0.979082775039.issue15805@psf.upfronthosting.co.za>
In-reply-to
Content
I think this should also be added to the whatsnew.

Regarding the examples, isn't it easier to say that:
  with redirect_stdout(sys.stderr):
      print('error')
is equivalent to
  print('error', file=sys.stderr)
?

I think that in most of the cases users are redirecting something that is being print()ed, and this example gets the point across (even if the "file" arg can be used for this specific case, it is not always the case if print() is called by a function).  Capturing help() and especially did.dis() output don't seem to me realistic/intuitive use cases for redirect_stdout().
History
Date User Action Args
2013-10-11 01:40:49ezio.melottisetrecipients: + ezio.melotti, barry, rhettinger, ncoghlan, belopolsky, pitrou, vstinner, alex, nikratio, python-dev, Marc.Abramowitz, vajrasky
2013-10-11 01:40:48ezio.melottisetmessageid: <1381455648.99.0.979082775039.issue15805@psf.upfronthosting.co.za>
2013-10-11 01:40:48ezio.melottilinkissue15805 messages
2013-10-11 01:40:48ezio.melotticreate