Get attribute of all items in container python
<p>I have the following (obviously simplified) class</p>

<pre><code>class A(object)
    def __init__(self, a):
        self.a = a
        self.b = 'b'
        # Other class attributes are added


class B(list):
    """
    Some customization of this class...
    """
    pass

BB = B([A(i) for i in range(10)])
</code></pre>

<p>I want to do</p>

<pre><code>B.a
</code></pre>

<p>and get a list of all the <code>a</code> attributes from every contained item in <code>B</code>. I know in order to do this, I need to overwrite <code>__getattr__</code>, but I'm not sure the best way to implement this. This needs to be generic as <code>B</code> doesn't know any of the attributes of <code>A</code> that may need to be accessed.</p>

<p>Can someone offer some advice on the implementation of this idea?</p>
