A class for C-like structuures in Python
Kevin Digweed
Kevin.Digweed at dial.pipex.com
Wed Aug 9 05:21:54 EDT 2000
Alex Martelli wrote:
> It would also be possible (but this is a matter of performance, and
> not a very important one) to optimize asBytes, if it's called often,
> into a single statement:
>
> def asBytes(self):
> return apply(struct.pack,[self.fmt]+self.members.values())
Be careful here - {}.values() does not yield a predictably ordered list.
Cheers, Kev.
More information about the Python-list
mailing list