Skip to content

Latest commit

 

History

History
35 lines (27 loc) · 1.05 KB

README.org

File metadata and controls

35 lines (27 loc) · 1.05 KB

about protocol buffer

Protocol Buffers  |  Google Developers https://developers.google.com/protocol-buffers/

dependencies

  • protoc for compiling proto files
  • protobuf==3.2.0 for handing pb in python

general proto file document

proto2 https://developers.google.com/protocol-buffers/docs/proto proto3 https://developers.google.com/protocol-buffers/docs/proto3

python documents

basic usage https://developers.google.com/protocol-buffers/docs/pythontutorial

references https://developers.google.com/protocol-buffers/docs/reference/python/

test protcol buffer

  • if sender has old proto file, receiver has new proto file that has new optional fields. Can receiver access the optional field without checking by HasField(‘xxx’)?

    yes. as long as the server has the new proto file, it’s okay to access the field directly without checking. you will get default value for the type.

    also check HasField’s document. I think it’s only used for duck typing at runtime.