diff --git a/Doc/library/dis.rst b/Doc/library/dis.rst index bc206f7d2e96af..7ea2bfde9f69e5 100644 --- a/Doc/library/dis.rst +++ b/Doc/library/dis.rst @@ -41,6 +41,10 @@ the following command can be used to display the disassembly of (The "2" is a line number). +:mod:`dis` an also be invoked as a script to disassemble other scripts. For example:: + + python -m dis myscript.py + Bytecode analysis ----------------- diff --git a/Lib/dis.py b/Lib/dis.py index 48a6ab8e41df3f..2f53f4f820c1fc 100644 --- a/Lib/dis.py +++ b/Lib/dis.py @@ -566,7 +566,7 @@ def dis(self): return output.getvalue() -def _test(): +def main(): """Simple test program to disassemble a file.""" import argparse @@ -579,4 +579,4 @@ def _test(): dis(code) if __name__ == "__main__": - _test() + main()