On Aug 26, 12:29 am, Jason Hsueh <
jas...@google.com> wrote:
> You can pull this from the descriptors:
> my_enum_descriptor = SomeMessage.DESCRIPTOR.enums_by_name['MyType']
> my_enum_descriptor.values_by_number[SomeMessage.FIRST].name
>
>
>
>
> On Wed, Aug 25, 2010 at 11:07 PM, Mike <
mspie...@gmail.com> wrote:
> > 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)
> > FIRST
>
> > Thanks!
>
> > --
> > You received this message because you are subscribed to the Google Groups
> > "Protocol Buffers" group.
> > To post to this group, send email to
prot...@googlegroups.com.
> > To unsubscribe from this group, send email to