Hello everyone!

I need to pack a long list of numbers into shared memory, so I thought
about using `struct.pack_into`.

Its signature is

    struct.pack_into(format, buffer, offset, v1, v2, ...)

I have a long list of nums (several millions), ended up doing the following:

    struct.pack_into(f'{len(nums)}Q', buf, 0, *nums)

However, passing all nums as `*args` is very inefficient [0]. So I
started wondering why we don't have something like:

    struct.pack_into(format, buffer, offset, values=values)

which would receive the list of values directly.

Is that because my particular case is very uncommon? Or maybe we *do*
want this but we don't have it yet? Or do we already have a better way
of doing this?

Thanks!

[0] https://linkode.org/#95ZZtVCIVtBbx72dURK7a4

-- 
.    Facundo

Blog: http://www.taniquetil.com.ar/plog/
PyAr: http://www.python.org.ar/
Twitter: @facundobatista
_______________________________________________
Python-Dev mailing list -- python-dev@python.org
To unsubscribe send an email to python-dev-le...@python.org
https://mail.python.org/mailman3/lists/python-dev.python.org/
Message archived at 
https://mail.python.org/archives/list/python-dev@python.org/message/4WYEIBOXPQPQ5EQL5WRYI6X7W36I6UQJ/
Code of Conduct: http://python.org/psf/codeofconduct/

Reply via email to