Description
In main Store.set
has the following signature:
zarr-python/src/zarr/abc/store.py
Line 256 in 498cb78
As a developer I want to know why I can't call store.set('foo', bytes_object)
-- why do I have to import this Buffer
class, then create a buffer from my bytes? I.e., why doesn't store.set
take BytesLike
?
The Buffer
ABC defines 2 class methods for creating buffers from non-buffers: from_bytes
and from_array_like
. Therefore every Buffer
class can turn BytesLike
or ArrayLike
instances into instances of that class, and so store.set(key, bytes)
could just get the default buffer prototype and create the buffer it needs from the byteslike / arraylike provided to set
.
So is there any reason why we shouldn't support this new function signature for Store.set
?
async def set(self, key: str, value: BytesLike | ArrayLike | Buffer) -> None: