Is there a more elegant way to do this?

Kamilche klachemin at home.com
Sat Jun 26 22:30:49 EDT 2004


Peter Otten <__peter__ at web.de> wrote in message news:<cbksil$ih9$07$1 at news.t-online.com>...

> 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