I'm finding that I am writing code that looks a lot like this:

tmpsubmessage = parse_submessage_data()
submessage = message.submessage.add()

This seems inefficient to me.  One alternative would be to create the
new submessage, and fill it on the spot:

submessage = message.submessage.add()

However, sometimes there's a bit of distance between when I'm
generating the data and when I'm putting it all together (such as
storing pre-made message sections, and loading them from a database
later).  What I really want is an append:

submessage = parse_submessage_data()

However, I can't see any way of doing this directly.  The closest I've
read about in the API is to create the message's parent, then merging
the parents together (in the implementation this automatically appends
repeated messages).  But that's impractical if the same message has
multiple potential parents.

Any ideas?

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

Reply via email to