I'm pretty sure this is possible, but I can't seem to figure it out.
There was another post about how to do this in C++, but I couldn't
figure out how to make it work in Python.

My message is similar to:

message SomeMessage {
  enum MyType {
    FIRST = 0;
    SECOND = 1;
    THIRD = 2;

  required MyType type = 0;

How do I programmatically get the string "FIRST" back if someone
passes me this message with the 'type' field set to SomeMessage.FIRST?

Something along the lines of...
>>> print SomeMessage.EnumName(SomeMessage.FIRST)


You received this message because you are subscribed to the Google Groups 
"Protocol Buffers" group.
To post to this group, send email to proto...@googlegroups.com.
To unsubscribe from this group, send email to 
For more options, visit this group at 

Reply via email to