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

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

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

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

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()
message.submessage.append(submessage)

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?

Thanks,
Daniel
--~--~---------~--~----~------------~-------~--~----~
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 
protobuf+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/protobuf?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to