Repository: scipy/scipy
File: scipy/stats/_distribution_infrastructure.py (Python)

Code before:
        if not _overrides('_munp'):
            CustomDistribution._moment_raw_formula = _moment_raw_formula_1
            CustomDistribution._moment_central_formula = _moment_central_formula

    support_etc = _combine_docs(CustomDistribution, include_examples=False).lstrip()
    docs = [
        f"This class represents `scipy.stats.{dist.name}` as a subclass of "
        "`ContinuousDistribution`.",
        f"The `repr`/`str` of class instances is `{repr_str}`.",
        f"The PDF of the distribution is defined {support_etc}"
    ]
    CustomDistribution.__doc__ = ("\n".join(docs))

    return CustomDistribution


def _get_domain_info(info):
    domain_info = {"endpoints": info} if isinstance(info, tuple) else info
    typical = domain_info.pop("typical", None)
    return domain_info, typical


def _make_distribution_custom(dist):
    dist_parameters = (
        dist.parameters if isinstance(dist.parameters, tuple) else (dist.parameters, )
    )
    parameterizations = []
    for parameterization in dist_parameters:
        parameters = []

        for name, info in parameterization.items():
            domain_info, typical = _get_domain_info(info)
            domain = _RealDomain(**domain_info)
            param = _RealParameter(name, domain=domain, typical=typical)
            parameters.append(param)
        parameterizations.append(_Parameterization(*parameters) if parameters else [])

    domain_info, _ = _get_domain_info(dist.support)
    _x_support = _RealDomain(**domain_info)
    _x_param = _RealParameter('x', domain=_x_support)
    repr_str = dist.__class__.__name__

    class CustomDistribution(ContinuousDistribution):
        _parameterizations = parameterizations
        _variable = _x_param

        def __repr__(self):
            s = super().__repr__()
            return s.replace('CustomDistribution', repr_str)

        def __str__(self):

Review comment (suggestion):
Interesting... I was going to comment about a confusing variable name, but I see why it's named this way. The attribute `parameters` of the custom distribution class really takes the place of `parameterization` in the infrastructure itself. 

Do you think the attribute should still be named `parameters` or should it be `parameterization`? Probably fine to keep it `parameters`, but address it as a comment in the code? (did we already discuss this?)

Code after:
            CustomDistribution._moment_central_formula = _moment_central_formula

    support_etc = _combine_docs(CustomDistribution, include_examples=False).lstrip()
    docs = [
        f"This class represents `scipy.stats.{dist.name}` as a subclass of "
        "`ContinuousDistribution`.",
        f"The `repr`/`str` of class instances is `{repr_str}`.",
        f"The PDF of the distribution is defined {support_etc}"
    ]
    CustomDistribution.__doc__ = ("\n".join(docs))

    return CustomDistribution


def _get_domain_info(info):
    domain_info = {"endpoints": info} if isinstance(info, tuple) else info
    typical = domain_info.pop("typical", None)
    return domain_info, typical


def _make_distribution_custom(dist):
    dist_parameters = (
        dist.parameters if isinstance(dist.parameters, tuple) else (dist.parameters, )
    )
    parameterizations = []
    for parameterization in dist_parameters:
        # The attribute name ``parameters`` appears reasonable from a user facing
        # perspective, but there is a little tension here with the internal. It's
        # important to keep in mind that the ``parameters`` attribute in a
        # user-created custom distribution specifies ``_parameterizations`` within
        # the infrastructure.
        parameters = []

        for name, info in parameterization.items():
            domain_info, typical = _get_domain_info(info)
            domain = _RealDomain(**domain_info)
            param = _RealParameter(name, domain=domain, typical=typical)
            parameters.append(param)
        parameterizations.append(_Parameterization(*parameters) if parameters else [])

    domain_info, _ = _get_domain_info(dist.support)
    _x_support = _RealDomain(**domain_info)
    _x_param = _RealParameter('x', domain=_x_support)
    repr_str = dist.__class__.__name__

    class CustomDistribution(ContinuousDistribution):
        _parameterizations = parameterizations
        _variable = _x_param

        def __repr__(self):
            s = super().__repr__()