Is there a more elegant way to do this?

Jeff Epler jepler at
Sun Jun 27 00:15:15 CEST 2004

something like this:
>     def pack(self):
>         lst = ['id', 'parent', 'number', 'x', 'y', 'z', 'red', \
>                    'green', 'blue', 'size', 'rotate', 'translucency']
          values = [getattr(self, attr) for attr in lst]
          return struct.pack('<IIIiiiBBBHHH', *values)

-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 196 bytes
Desc: not available
URL: <>

More information about the Python-list mailing list