(self, extension_handle)
return result
Returns the current value of the given extension handle.
Returns the current value of the given extension handle.
Returns the current value of the given extension handle .
def __getitem__(self, extension_handle):
    """Returns the current value of the given extension handle."""

    _VerifyExtensionHandle(self._extended_message, extension_handle)

    result = self._extended_message._fields.get(extension_handle)
    if result is not None:
      return result

    if extension_handle.label == _FieldDescriptor.LABEL_REPEATED:
      result = extension_handle._default_constructor(self._extended_message)
    elif extension_handle.cpp_type == _FieldDescriptor.CPPTYPE_MESSAGE:
      result = extension_handle.message_type._concrete_class()
      try:
        result._SetListener(self._extended_message._listener_for_children)
      except ReferenceError:
        pass
    else:
      # Singular scalar -- just return the default without inserting into the
      # dict.
      return extension_handle.default_value

    # Atomically check if another thread has preempted us and, if not, swap
    # in the new object we just created.  If someone has preempted us, we
    # take that object and discard ours.
    # WARNING:  We are relying on setdefault() being atomic.  This is true
    #   in CPython but we haven't investigated others.  This warning appears
    #   in several other locations in this file.
    result = self._extended_message._fields.setdefault(
        extension_handle, result)

    return result
def __getitem__ ( self , extension_handle ) : _VerifyExtensionHandle ( self . _extended_message , extension_handle ) result = self . _extended_message . _fields . get ( extension_handle ) if result is not None : return result if extension_handle . label == _FieldDescriptor . LABEL_REPEATED : result = extension_handle . _default_constructor ( self . _extended_message ) elif extension_handle . cpp_type == _FieldDescriptor . CPPTYPE_MESSAGE : result = extension_handle . message_type . _concrete_class ( ) try : result . _SetListener ( self . _extended_message . _listener_for_children ) except ReferenceError : pass else : # Singular scalar -- just return the default without inserting into the # dict. return extension_handle . default_value # Atomically check if another thread has preempted us and, if not, swap # in the new object we just created.  If someone has preempted us, we # take that object and discard ours. # WARNING:  We are relying on setdefault() being atomic.  This is true #   in CPython but we haven't investigated others.  This warning appears #   in several other locations in this file. result = self . _extended_message . _fields . setdefault ( extension_handle , result ) return result