mercredi 2 septembre 2020

How to extend protobuf objects in python

I've defined a protobuf message that I'd like to create a wrapper/proxy/boilerplate/extension/anything for so I can add custom methods.

The docs for protobuf say that you are advised not to inherit directly from the protobuf as under the hood, it's actually a descriptor and metaclass that define most of the methods/attributes.

I was wondering how people go about "inheriting" a class as best as possible when inheritance is not a stable option, or if anyone has had any luck using protobuf codegen to extend/define a custom Message class and if that's a reasonable idea.

Aucun commentaire:

Enregistrer un commentaire