When writing literate Python with Org–Babel, I need to be able to control the indentation level (either explicitly with :indentation-level 3
or implicitly with some clever indication).
Here's an example file that demonstrates the problem.
#+BEGIN_SRC python :tangle "sample.py"
class Test:
def __init__(self):
self.a = 'a test class'
#+END_SRC
#+BEGIN_SRC python :tangle "sample.py"
def say_hi(self):
print 'Hi from this Test object!'
print 'ID: {}'.format(repr(self))
print 'Data: {}'.format(str(self.__dict__))
#+END_SRC
Set
org-src-preserve-indentation
tot
.