title: Anonymous code blocks
body: <p>Preface:</p>
  
  <p>So far I've used Python as a full scale programming language. Now I like to use it to write down some notes (comments) with some calculation (Python code) here and there (I'm actually using Emacs and send the current buffer again and again to a running IPython instance).</p>
  
  <p>The problem: I like to reuse some common variable names like 'A' or 'd' multiple times within the same document without running into the problem that I accidentally forget to reassign the value to one of these variable names.</p>
  
  <p>I so far abuse the class statement</p>
  
  <pre><code># Topic one: bla bla
  class _anon:
      d = 10
      A = d**2 * pi /4
  
  # Topic two: bla bla
  class _anon:
      A = d**2 * pi /4 # error is raised since d is missing
  </code></pre>
  
  <p>This works, since a class statement creates an execution frame which works as a variable scope,  but I wonder if there is dedicated syntax for this use case.</p>