One thing I'm curious about in the ctypes vs this PEP debate is the following. How do the approaches differ in practice if I'm developing a library that wants to accept various image formats that all describe the same thing: rgb data. Let's say for now all I want to support is two different image formats whose pixels are described in C structs by:
struct rbg565 { unsigned short r:5; unsigned short g:6; unsigned short b:5; }; struct rgb101210 { unsigned int r:10; unsigned int g:12; unsigned int b:10; }; Basically in my code I want to be able to take the binary data descriptor and say "give me the 'r' field of this pixel as an integer". Is either one (the PEP or c-types) clearly easier to use in this case? What would the code look like for handling both formats generically? --bb _______________________________________________ Python-Dev mailing list Python-Dev@python.org http://mail.python.org/mailman/listinfo/python-dev Unsubscribe: http://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com