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

Code before:
        res = self._logmoment_quad(order, logcenter, **self._parameters)
        if standardized:
            logvar = self._logmoment_quad(2, logmean, **self._parameters)
            res = res - logvar * (order/2)
        return res

    def _logmoment_quad(self, order, logcenter, **params):
        def logintegrand(x, order, logcenter, **params):
            logpdf = self._logpxf_dispatch(x, **params)
            return logpdf + order * _logexpxmexpy(np.log(x + 0j), logcenter)
            ## if logx == logcenter, `_logexpxmexpy` returns (-inf + 0j)
            ## multiplying by order produces (-inf + nan j) - bad
            ## We're skipping logmoment tests, so we might don't need to fix
            ## now, but if we ever do use run them, this might help:
            # logx = np.log(x+0j)
            # out = np.asarray(logpdf + order*_logexpxmexpy(logx, logcenter))
            # i = (logx == logcenter)
            # out[i] = logpdf[i]
            # return out
        return self._quadrature(logintegrand, args=(order, logcenter),
                                params=params, log=True)

    ### L-Moments

    @_set_invalid_nan_property
    def lmoment(self, order=1, *, standardized=False, method=None):
        min_order = 1 if not standardized else 3
        order = self._validate_order(order, fname='lmoment', min_order=min_order)
        return self._lmoment(order, standardized=standardized, method=method)

    def _lmoment(self, order, *, standardized, method):
        methods = self._lmoment_methods if method is None else {method}

        lmoment = self._lmoment_dispatch(order, methods=methods, **self._parameters)
        if lmoment is None:
            return None

        if standardized and lmoment is not None:
            # todo: add general result: if `order==2` and `standardized`, return unity.
            lscale = self._lmoment_dispatch(2, methods=methods, **self._parameters)
            if lscale is None:
                return None
            lmoment = lmoment / lscale

        return lmoment

    def _lmoment_dispatch(self, order, *, methods, **params):
        lmoment = None

        if 'cache' in methods:
            lmoment = self._lmoment_cache.get(order, None)

Review comment (suggestion):
```suggestion
    def lmoment(self, order=1, *, standardize=False, method=None):
```
For consistency for `stats.lmoment`. I don't think this is inconsistent with the fact that `ContinuousDistribution.moment` has `kind='standardized'`; one is used a verb, the other as an adjective.

Code after:
        res = self._logmoment_quad(order, logcenter, **self._parameters)
        if standardized:
            logvar = self._logmoment_quad(2, logmean, **self._parameters)
            res = res - logvar * (order/2)
        return res

    def _logmoment_quad(self, order, logcenter, **params):
        def logintegrand(x, order, logcenter, **params):
            logpdf = self._logpxf_dispatch(x, **params)
            return logpdf + order * _logexpxmexpy(np.log(x + 0j), logcenter)
            ## if logx == logcenter, `_logexpxmexpy` returns (-inf + 0j)
            ## multiplying by order produces (-inf + nan j) - bad
            ## We're skipping logmoment tests, so we might don't need to fix
            ## now, but if we ever do use run them, this might help:
            # logx = np.log(x+0j)
            # out = np.asarray(logpdf + order*_logexpxmexpy(logx, logcenter))
            # i = (logx == logcenter)
            # out[i] = logpdf[i]
            # return out
        return self._quadrature(logintegrand, args=(order, logcenter),
                                params=params, log=True)

    ### L-Moments

    @_set_invalid_nan_property
    def lmoment(self, order=1, *, standardize=True, method=None):
        order = self._validate_order(order, fname='lmoment', min_order=1)
        return self._lmoment(order, standardize=standardize, method=method)

    def _lmoment(self, order, *, standardize, method):
        methods = self._lmoment_methods if method is None else {method}

        lmoment = self._lmoment_dispatch(order, methods=methods, **self._parameters)
        if lmoment is None:
            return None

        if standardize and order >= 3 and lmoment is not None:
            lscale = self._lmoment_dispatch(2, methods=methods, **self._parameters)
            if lscale is None:
                return None
            lmoment = lmoment / lscale

        return lmoment

    def _lmoment_dispatch(self, order, *, methods, **params):
        lmoment = None

        if 'cache' in methods:
            lmoment = self._lmoment_cache.get(order, None)

        if lmoment is None and 'formula' in methods: