title: Why is my Protobuf message (in Python) ignoring zero values?
body: <p>I've been working on implementing protobufs for IPC for a project. For some reason, values that are set to 0 are not being set/serialized. For context, the .proto file contains the following message: </p>
  
  <pre><code>syntax = "proto3";
  
  enum SetGet {
      SET = 0;
      GET = 1;
  }
  
  message State {
      SetGet setget = 1;
      double x = 2;
      double y = 3;
      double depth = 4;
      double yaw = 5;
      double pitch = 6;
      double roll = 7; 
  }
  </code></pre>
  
  <p>I compile the file to a Python _pb2 file with protoc, and then I try running the following test script:</p>
  
  <pre><code>import filename_pb2 as pb
  
  state = pb.State()
  state.x = 0
  state.y = 0
  state.depth = 0
  state.yaw = 0
  state.pitch = 0
  state.roll = 0
  state.setget = pb.SET
  
  print("State: {}".format(state))
  
  state2 = pb.State()
  state2.ParseFromString(state.SerializeToString())
  
  print("State2: {}".format(state2))
  </code></pre>
  
  <p>When I run it, the following output is printed:</p>
  
  <pre><code>State: 
  State2: 
  </code></pre>
  
  <p>It seems that nothing is being set, or that the zero values are somehow being ignored.
  However, when I change the values (x, y, depth, etc.) to something nonzero, say 0.1, I get the following, expected result:</p>
  
  <pre><code>State: x: 0.1
  y: 0.1
  depth: 0.1
  yaw: 0.1
  pitch: 0.1
  roll: 0.1
  
  State2: x: 0.1
  y: 0.1
  depth: 0.1
  yaw: 0.1
  pitch: 0.1
  roll: 0.1
  </code></pre>
  
  <p>Even though the numbers are printed out, for some reason the enum still isn't.
  Why does this happen with protobufs? Is the double type 0 by default, so the protobuf serializer saves on space by ignoring them? Why, then, are they not being restored when State2 is parsed in? Is there some line in the documentation that I missed? Thanks in advance!</p>
  
  <p>-- Tim</p>