def __init__(self, min=None, max=None, weight=1, preferred=None):
        assert isinstance(weight, int) and weight > 0   # Cannot be a float.

        self.min_specified = min is not None
        self.max_specified = max is not None
        self.preferred_specified = preferred is not None

        if min is None:
            min = 0  # Smallest possible value.
        if max is None:  # 0-values are allowed, so use "is None"
            max = 1000 ** 10  # Something huge.
        if preferred is None:
            preferred = min

        self.min = min
        self.max = max
        self.preferred = preferred
        self.weight = weight

        # Make sure that the 'preferred' size is always in the min..max range.
        if self.preferred < self.min:
            self.preferred = self.min

        if self.max > self.preferred:
            self.preferred = self.max
dataset/ETHPy150Open jonathanslenders/python-prompt-toolkit/prompt_toolkit/layout/dimension.py/LayoutDimension.__init__/swapped operands of `>`