title: python nesting dictionary: OrderedDict from collections
body: <p>how to nest a OrderedDict?</p>
  
  <p>i tried:</p>
  
  <pre><code>table=collections.OrderedDict()
  table['E']['a']='abc'
  </code></pre>
  
  <p>but this shows error.</p>
  
  <p>i tried also:</p>
  
  <pre><code>table=collections.OrderedDict(OrderedDict())
  table['E']['a']='abc'
  </code></pre>
  
  <p>this also shows error.</p>
  
  <p>i tried:</p>
  
  <pre><code>table=collections.OrderedDict()
  table['E']=collections.OrderedDict()
  table['E']['a']='abc'
  </code></pre>
  
  <p>this works fine.</p>
  
  <p>in my coding i had to use like this:</p>
  
  <pre><code>table=collections.OrderedDict()
  for lhs in left:
      table[lhs]=collections.OrderedDict()
      for val in terminal:
          table[lhs][val]=0
  </code></pre>
  
  <p>which works fine. but is there any other method. as i read python manages its data structure automatically.</p>
  
  <p>is there anyway to declare a dictionary along with how much nesting it'll be and what will be the data-structures of its nests in one line.</p>
  
  <p>using an extra loop just to declare a dictionary feels like i'm missing something in python.</p>