Run benchmarks with timeit
https://docs.python.org/3/library/timeit.html
$ python -m timeit '"-".join(str(n) for n in range(100))'
>>> timeit.timeit('"-".join(str(n) for n in range(100))', number=10000)
Ruby’s binding.pry in Python
import code; code.interact(local=dict(globals(), **locals()))
Python built-in commands
# This command serves the passed-in directory on port 8000 via http
python -m http.server 8000 -d .
# Launch a webbrowser
python -m webbbrowser
# Format JSON
python -m json.tool
# Show a calendar
python -m calendar
# Run the Python debugger
python -m pdb
# Show documentation for given string
python -m pydoc
# Run profiler
python -m cProfile
python -m profile
python -m pstats
Analyze code
python -m tokenize
python -m ast
python -m dis
python -m inspect
python -m pyclbr