title: Pythonic conditions in dictionary and dictionary comprehension
body: <p>Say a have a superclass SuperClass and two children classes ClassA and ClasseB:</p>
  <pre><code>class SuperClass:
      def __init__(self,superAttribute):
          self.superAttribute = superAttribute
  
  class ClassA(SuperClass):
      def __init__(self,superAttribute,attributeA):
          self.attributeA = attributeA
  
  class ClassB(SuperClass):
      def __init__(self,superAttribute,attributeB):
          self.attributeB = attributeB
  </code></pre>
  <p>Now I have a list of ClassA and ClassB objects <code>aBList</code> and I want to create a dictionary as follows:</p>
  <pre><code>aBDict = {}
  for aB in aBList:
      aBDict['aKey'] = aB.attributeA # if aB has an attributeA attribute 
      aBDict['bKey'] = aB.attributeB # if aB has an attributeB attribute 
  </code></pre>
  <p>In other words, as it's the case with list comprehension, is there a Pythonic dictionary comprehension that would use the classic if structure?</p>