def set_prior(self, prior, warning=True):
repriorized = self.unset_priors()<EOL>self._add_to_index_operations(self.priors, repriorized, prior, warning)<EOL>from paramz.domains import _REAL, _POSITIVE, _NEGATIVE<EOL>if prior.domain is _POSITIVE:<EOL><INDENT>self.constrain_positive(warning)<EOL><DEDENT>elif prior.domain is _NEGATIVE:<EOL><INDENT>self.constrain_negative(warning)<EOL><DEDENT>elif prior.domain is _REAL:<EOL><INDENT>rav_i = self._raveled_index()<EOL>assert all(all(False if c is __fixed__ else c.domain is _REAL for c in con) for con in self.constraints.properties_for(rav_i)), '<STR_LIT>'<EOL><DEDENT>
Set the prior for this object to prior.
:param :class:`~GPy.priors.Prior` prior: a prior to set for this parameter
:param bool warning: whether to warn if another prior was set for this parameter