Ich will eine Liste von Attributen erhalten. Eine möglichkeit habe ich schon über getattr und map gefunden.
Also:
Code: Alles auswählen
class Test:
def __init__(self, Attribut):
self.Attribut = Attribut
Objekte = [Test(1), Test(2), Test(3), Test(4)]
Attribute = map(lambda Objekt: getattr(Objekt, 'Attribut'), Objekte)
print Attribute