Tony Houghton wrote: > I'm writing a python program which reads input device events so it > needs to know sizeof(struct timeval). By using the struct module I > should be able to work out sizeof(long) from python, but I can't > think of a way to measure non-fundamental types without including a > little bit of C, which I'd rather avoid. > > How safe would I be assuming that > > sizeof(struct timeval) == 2 * sizeof(long) > > is always true on Linux on different architectures? AFAIK the input > device interface is Linux-specific so I don't need to worry about > other OS's.
If I were you, I would write a Pyrex 4-liners which exposes this structure to Python in the way you prefer. This would immediately fix all these compatibility issues. -- Giovanni Bajo -- http://mail.python.org/mailman/listinfo/python-list