[Python-Dev] PEP: Adding data-type objects to Python (original) (raw)
"Martin v. Löwis" martin at v.loewis.de
Wed Nov 1 09:24:06 CET 2006
- Previous message: [Python-Dev] PEP: Adding data-type objects to Python
- Next message: [Python-Dev] PEP: Adding data-type objects to Python
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Bill Baxter schrieb:
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?
The PEP, as specified, does not support accessing individual fields from Python. OTOH, ctypes, as implemented, does. This comparison is not fair, though: an implementation of the PEP (say, NumPy) might also give you Python-level access to the fields.
With the PEP, you can get access to the 'r' field from C code. Performing this access is quite tedious; as I'm uncertain whether you actually wanted to see C code, I refrain from trying to formulate it.
Regards, Martin
- Previous message: [Python-Dev] PEP: Adding data-type objects to Python
- Next message: [Python-Dev] PEP: Adding data-type objects to Python
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]