[Python-Dev] Memoryviews should expose the underlying memory address

David Beazley dave at dabeaz.com
Fri Sep 21 14:07:09 CEST 2012


On Sep 21, 2012, at 4:45 AM, Maciej Fijalkowski wrote:
> 
> This is also kind of a problem with PyPy and CFFI, where we actively
> discourage people from using C. Passing address as an int sounds like
> a very reasonable solution.
> 

I just wanted to add that getting the address as an integer is useful because one might actually want to do math with it.   Since memoryviews also expose the shape, itemsize, and other information, it's conceivable that one might combine these with the base address to compute locations within the array.  Example: take a memoryview, slice up the buffer into partitions and hand them off to worker functions running in a thread pool.

Cheers,
Dave



More information about the Python-Dev mailing list