Setting extensions for empty messages in python

181 views
Skip to first unread message

CARSON DEAN FENIMORE

unread,
Aug 5, 2010, 1:56:19 PM8/5/10
to prot...@googlegroups.com
Let's say you have a message (A) that has an extension field (F) that
is a message (B) that no fields. To "set" F on an instance of A in c++
you would call instance.MutableExtension(F). It appears the python
analog is something like:

a = A()
a.Extensions[F]._Modified()

Is this correct?

Kenton Varda

unread,
Aug 10, 2010, 5:48:41 PM8/10/10
to CARSON DEAN FENIMORE, prot...@googlegroups.com
Members that start with an underscore are private and may go away in the future.  Use SetInParent(), which is explicitly meant for this exact purpose:

  a.Extensions[F].SetInParent();


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


Kenton Varda

unread,
Aug 10, 2010, 5:49:00 PM8/10/10
to CARSON DEAN FENIMORE, prot...@googlegroups.com
On Tue, Aug 10, 2010 at 2:48 PM, Kenton Varda <ken...@google.com> wrote:
Members that start with an underscore are private and may go away in the future.  Use SetInParent(), which is explicitly meant for this exact purpose:

  a.Extensions[F].SetInParent();

Er, without the semicolon.  Sorry, I'm used to C++.
Reply all
Reply to author
Forward
0 new messages