Skip to content

Instantly share code, notes, and snippets.

@jbalogh
Created April 2, 2010 15:38
Show Gist options
  • Save jbalogh/353276 to your computer and use it in GitHub Desktop.
Save jbalogh/353276 to your computer and use it in GitHub Desktop.
iPython macros are great for executing the same code over and over.
In [6]: hist
1: _ip.magic("ed xx")
2: from addons.models import AddonRecommendation, Addon
3: import transformer
4: q = Addon.objects.all().transform(transformer.get_trans).filter(id=1865)
5: q.get()
6: _ip.magic("hist ")
In [7]: macro xx 2-5
Macro `xx` created. To execute, type its name (without quotes).
Macro contents:
from addons.models import AddonRecommendation, Addon
import transformer
q = Addon.objects.all().transform(transformer.get_trans).filter(id=1865)
q.get()
In [8]: store xx
Stored 'xx' (Macro)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment