Re: [Tutor] dynamically executing a statement

2006-07-14 Thread Kent Johnson
Emily Fortuna wrote: > Hello all, > I am writing a function in which (in its simplified form) I am trying to > return a list of a specified attribute, given a list of objects. It is > best if I write some hypothetical code to explain: > class foo: > def __init__(self, name, data): >

Re: [Tutor] dynamically executing a statement

2006-07-14 Thread Fabrizio Milo aka misto
Did you considered getattr? > def getAttrs(fooObjs, attr): > return map(lambda item: getattr(item, attr), fooObjs) ___ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor