Re:Unpacking Elixir: Concurrency
by throwawaymaths on Friday August 25, 2023 @08:25AM
(#37260911)
Python lists are generally not contiguously allocated memory (I think it might be if you are storing integers less than 255), don't be fooled. That's why you need numpy.
[ Parent
| on HN ]
Re:Unpacking Elixir: Concurrency
by peoplefromibiza on Friday August 25, 2023 @08:53AM
(#37261138)
I'm talking about Python arrays
https://docs.python.org/3/library/array.html
>>> a = array('B', [1, 2, 3, 4, 5])
>>> str(a.buffer_info()[1] * a.itemsize) + " bytes at address #" + str(a.buffer_info()[0])
'5 bytes at address #4379640336'
>>> b = array('l', [1, 2, 3, 4, 5])
>>> str(b.buffer_info()[1] * b.itemsize) + " bytes at address #" + str(b.buffer_info()[0])
'40 bytes at address #4380812752'