Is there a more elegant way to do this?

Kamilche klachemin at
Sun Jun 27 04:30:49 CEST 2004

Peter Otten <__peter__ at> wrote in message news:<cbksil$ih9$07$1 at>...

> struct.pack("<IIIiiiBBBHHH", *[getattr(self, name) for name in lst])

Thanks Peter! I knew there must be a way, but I don't comprehend list
comprehensions yet.

And I didn't know about the 'don't need backslashes when in a
bracket', thanks Shalabh.


More information about the Python-list mailing list