(self, extension_handle, value)
If extension_handle specifies a non-repeated, scalar extension
    field, sets the value of that field.
If extension_handle specifies a non-repeated, scalar extension
    field, sets the value of that field.
If extension_handle specifies a non - repeated scalar extension field sets the value of that field .
def __setitem__(self, extension_handle, value):
    """If extension_handle specifies a non-repeated, scalar extension
    field, sets the value of that field.
    """

    _VerifyExtensionHandle(self._extended_message, extension_handle)

    if (extension_handle.label == _FieldDescriptor.LABEL_REPEATED or
        extension_handle.cpp_type == _FieldDescriptor.CPPTYPE_MESSAGE):
      raise TypeError(
          'Cannot assign to extension "%s" because it is a repeated or '
          'composite type.' % extension_handle.full_name)

    # It's slightly wasteful to lookup the type checker each time,
    # but we expect this to be a vanishingly uncommon case anyway.
    type_checker = type_checkers.GetTypeChecker(extension_handle)
    # pylint: disable=protected-access
    self._extended_message._fields[extension_handle] = (
        type_checker.CheckValue(value))
    self._extended_message._Modified()
def __setitem__ ( self , extension_handle , value ) : _VerifyExtensionHandle ( self . _extended_message , extension_handle ) if ( extension_handle . label == _FieldDescriptor . LABEL_REPEATED or extension_handle . cpp_type == _FieldDescriptor . CPPTYPE_MESSAGE ) : raise TypeError ( 'Cannot assign to extension "%s" because it is a repeated or ' 'composite type.' % extension_handle . full_name ) # It's slightly wasteful to lookup the type checker each time, # but we expect this to be a vanishingly uncommon case anyway. type_checker = type_checkers . GetTypeChecker ( extension_handle ) # pylint: disable=protected-access self . _extended_message . _fields [ extension_handle ] = ( type_checker . CheckValue ( value ) ) self . _extended_message . _Modified ( )