I perfectly understand that the API is awful, but there is no way to change
it without breaking backward compatibility.

It is impossible to make classes with the metaclass GeneralObjectMeta
hashable. Firstly, these classes are mutable.
Secondly, their hashcode can be calculated properly only with meta registry
and possibly with network requests.

Possible solution is to return not a dictionary, but a list of kv tuples.
But it will also break backward compatibility.
I don't understand why this variant was not chosen.

пн, 26 дек. 2022 г. в 18:52, Ivan Daschinsky <[email protected]>:

> Nope, unfotunately there is not any built in method. But it seems that
> this is not necessary at all to do this?
>
> def wrap_binary(client, value) :
>     with BinaryStream(client) as stream:
>         BinaryObject.from_python(stream, value)
>         return (stream.getvalue(), 0)
>
> for k in data.keys():
>     key = client.unwrap_binary(k)
>
>     print(key)
>     print(data[wrap_binary(client, key)])
>
>

-- 
Sincerely yours, Ivan Daschinskiy

Reply via email to