Message199372
| Author |
vajrasky |
| Recipients |
Marc.Abramowitz, alex, barry, belopolsky, ezio.melotti, ncoghlan, nikratio, pitrou, python-dev, rhettinger, vajrasky, vstinner |
| Date |
2013年10月10日.08:44:00 |
| SpamBayes Score |
-1.0 |
| Marked as misclassified |
Yes |
| Message-id |
<1381394640.57.0.243158062383.issue15805@psf.upfronthosting.co.za> |
| In-reply-to |
| Content |
Nice.
My only complain is the dis.dis example. We don't have to use redirect_stdout context manager.
+ # How to capture disassembly to a string
+
+ import dis
+ import io
+
+ f = io.StringIO()
+ with redirect_stdout(f):
+ dis.dis('x**2 - y**2')
+ s = f.getvalue()
dis.dis supports file object natively. We can do this instead:
dis.dis('x**2 - y**2', file=f) |
|
History
|
|---|
| Date |
User |
Action |
Args |
| 2013年10月10日 08:44:00 | vajrasky | set | recipients:
+ vajrasky, barry, rhettinger, ncoghlan, belopolsky, pitrou, vstinner, ezio.melotti, alex, nikratio, python-dev, Marc.Abramowitz |
| 2013年10月10日 08:44:00 | vajrasky | set | messageid: <1381394640.57.0.243158062383.issue15805@psf.upfronthosting.co.za> |
| 2013年10月10日 08:44:00 | vajrasky | link | issue15805 messages |
| 2013年10月10日 08:44:00 | vajrasky | create |
|