Relative Content

Tag Archive for pythonprotocol-buffers

How to avoid `setattr` (and `getattr`) when using Python? And is it necessary to avoid

If I want to add a value to a field in a protocol buffer that isn’t known at compile time, I’m currently doing setattr. I normally don’t like using setattr because it seems less secure. But when I know the object is a protobuf, I’m thinking it is fine, because the value I’m setting it to must be of the type that the protobuf allows. So maybe it isn’t really unsafe??