[Numpy-discussion] Suggestion: add an pad parameter to np.memmap

Tom Swirly tom at swirly.com
Wed Dec 23 15:05:55 EST 2020


Hello, and thanks for all your work on the amazing numpy.

I'm using np.memmap() with great success for memory mapping WAV audio
files, with one tiny blemish - the WAV spec wants me to sometimes put one
byte after the list of samples that I'm memory mapping, which I can't do
easily when writing a new file.


This little patch is probably backward compatible and would accomplish what
I need:

https://github.com/rec/numpy/commit/4dd855b14bed5947f2f9120979c9ee936c17158f

If there were interest, I could figure out numpy's test system and write
tests for it.


(For the foreseeable future, I'm intercepting the call to mmap.mmap() to
add the padding, so I'm not blocked, though the code has aspects of
ugliness.)

-- 
     /t

PGP Key: https://flowcrypt.com/pub/tom.ritchford@gmail.com
*https://tom.ritchford.com <https://tom.ritchford.com>*
*https://tom.swirly.com <https://tom.swirly.com>*
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://mail.python.org/pipermail/numpy-discussion/attachments/20201223/d4266a22/attachment.html>


More information about the NumPy-Discussion mailing list