PyArrow Plasma object ids, "sealing" makes an object immutable, pyristent
Objects are created in Plasma in two stages. First, they are created,
which allocates a buffer for the object. At this point, the client can write to the buffer and construct the object within the allocated buffer.
To create an object for Plasma, you need to create an object ID, as well
as give the object’s maximum size in bytes.
# Create an object buffer. object_id = plasma.ObjectID(20 * b"a") object_size = 1000 buffer = memoryview(client.create(object_id, object_size)) # Write to the buffer. for i in range(1000): buffer[i] = i % 128
When the client is done, the client seals the buffer, making the object
immutable, and making it available to other Plasma clients.
# Seal the object. This makes the object immutable and available to other
https://pypi.org/project/pyrsistent/ also supports immutable structures
On Sat, Aug 1, 2020 at 4:44 PM Eric V. Smith email@example.com wrote:
On 8/1/2020 1:25 PM, Marco Sulla wrote:
You don't need locks with immutable objects. Since they're immutable, any operation that usually will mutate the object, generate another immutable instead. The most common example is str: the sum of two strings in Python (and in many other languages) produces a new string.
While they're immutable at the Python level, strings (and all other objects) are mutated at the C level, due to reference count updates. You need to consider this if you're sharing objects without locking or other synchronization.
Python-ideas mailing list -- firstname.lastname@example.org To unsubscribe send an email to email@example.com https://mail.python.org/mailman3/lists/python-ideas.python.org/ Message archived at https://firstname.lastname@example.org/message/FEJEHF... Code of Conduct: http://python.org/psf/codeofconduct/