This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author memeplex
Recipients amaury.forgeotdarc, belopolsky, eryksun, meador.inge, memeplex
Date 2016-07-10.18:10:35
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1468174235.1.0.245386467845.issue27274@psf.upfronthosting.co.za>
In-reply-to
Content
As usual, thank you for the detailed and informative answer, Eryk. I think I understand your points but I decided to do it the way I did it because:

1. I sometimes need the array itself. For example, some of my clases contains or inherits from a ctypes structure with pointers (to an array of memory). Usually I name these pointers with a leading underscore and expose them as properties returning ctypes arrays.

2. For pickling/unpickling ctypes arrays provide a convenient middle-point between bytes objects and ctypes pointers. Getting a bytes object from an array is as easy as calling bytes() on it. OTOH, the array can be directly assigned to a compatible pointer structure field.

3. While the overloaded c_array(ptr, size)/c_array(type, bytes) is not the most efficient api to get bytes from a pointer and viceversa, it's very simple for the range of uses cases (1 and 2) it covers. Nevertheless, I have benchmarked the perfomance and it's not that terrible.
History
Date User Action Args
2016-07-10 18:10:35memeplexsetrecipients: + memeplex, amaury.forgeotdarc, belopolsky, meador.inge, eryksun
2016-07-10 18:10:35memeplexsetmessageid: <1468174235.1.0.245386467845.issue27274@psf.upfronthosting.co.za>
2016-07-10 18:10:35memeplexlinkissue27274 messages
2016-07-10 18:10:35memeplexcreate