#ShareableList

Alexandre B A Villares 🐍villares@ciberlandia.pt
2023-09-26

Have you ever played with #Python's #sharedMemory #ShareableList ?

Two Python REPLs, the first on the right:

Python 3.10.4 (/home/villares/thonny-python-env/bin/python3)
>>> from multiprocessing import shared_memory
>>> b = shared_memory.ShareableList(range(10))
>>> b
ShareableList([0, 1, 2, 3, 4, 5, 6, 7, 8, 9], name='psm_2cc133d4')
>>> b
ShareableList([12123123, 1, 2, 3, 4, 5, 6, 7, 8, 9], name='psm_2cc133d4')
>>> 


the second on the left:

Python 3.10.4 (/home/villares/thonny-python-env/bin/python3)
>>> from multiprocessing import shared_memory
>>> b = shared_memory.ShareableList(name='psm_2cc133d4')
>>> b
ShareableList([0, 1, 2, 3, 4, 5, 6, 7, 8, 9], name='psm_2cc133d4')
>>> b[0] = 12123123
>>>

Client Info

Server: https://mastodon.social
Version: 2025.07
Repository: https://github.com/cyevgeniy/lmst