IPython
Tips & Tricks
Created by Sebastian Witowski
2 kinds of Pythonistas
Live demo #1
%magic
%edit
def hello(name):
print 'Hello', name '!'
%debug
def hello(name):
print 'Hello', name, '!'
print number + 42
%cpaste
def hello(name):
print 'Hello', name, '!'
print number + 42
number = 0
%timeit function()
%pastebin 10-20
# 'https://gist.github.com/8f03e623fe366'
%macro foo 10-20
%save foo.py 10-20
Shell commands:
ls
pwd
cd ..
!ping www.google.com
Debugging your code with IPython:
some code
import IPython; IPython.embed()
some other code that fails
Summary
- Tab completion
- Easy access to documentation with ? and ??
- %magic function
- Shell commands
- Debugging
Where can I get it ?
http://ipython.org/install.html
Questions ?