Skip to content

Latest commit

 

History

History
85 lines (60 loc) · 1.53 KB

org_py_demo.org

File metadata and controls

85 lines (60 loc) · 1.53 KB

Org Mode Python

Obviously ever thing is better in Emacs. With a bit of setup, found here, it is possible to have plain text, org style formatting and, evaluated code, and images at the tips of your finger.

Benefits:

  • Org-mode is highly extensible
  • Auto complete, pep8 and other options are available
  • Git integration is far easier

Limitations

  • Messy interactive graphs
  • Hard to set up
  • Vim users look at you weird

Examples:

import matplotlib.pyplot as plt
import numpy as np
%matplotlib inline
plt.hist(np.random.randn(20000), bins=200);

./obipy-resources/0ocAKi.png

It is trivial to mix code and analysis.

def foo(x):
    return x + 9

[foo(x) + 7 for x in range(7)]
[16, 17, 18, 19, 20, 21, 22]

Issues:

Care must be taken to name code chunks

try:
   foo(1)
except :  print("Did not work")

This one is named correctly.

foo(4)
print("did work")
13

My current setup after getting a new laptop is subpar, still check it out.