0

Hello I am looking in python random module and in Random(_random.Random) class I found multiple def without any function definition and indention. Please someone explain what is going on. I have searched by myself but did't find anything, may be I did't know what would be the proper search term.

hare is the the code I am talking about.

class Random(_random.Random):
def __init__(self, x: Any = ...) -> None: ...
def seed(self, a: Any = ..., version: int = ...) -> None: ...
def getstate(self) -> Tuple[Any, ...]: ...
def setstate(self, state: Tuple[Any, ...]) -> None: ...
def getrandbits(self, k: int) -> int: ...
def randrange(self, start: int, stop: Union[int, None] = ..., step: int = ...) -> int: ...
def randint(self, a: int, b: int) -> int: ...
def choice(self, seq: Sequence[_T]) -> _T: ...
if sys.version_info >= (3, 6):
    def choices(self, population: Sequence[_T], weights: Optional[Sequence[float]] = ..., *, cum_weights: Optional[Sequence[float]] = ..., k: int = ...) -> List[_T]: ...
def shuffle(self, x: List[Any], random: Union[Callable[[], float], None] = ...) -> None: ...
def sample(self, population: Union[Sequence[_T], AbstractSet[_T]], k: int) -> List[_T]: ...
def random(self) -> float: ...
def uniform(self, a: float, b: float) -> float: ...
def triangular(self, low: float = ..., high: float = ..., mode: float = ...) -> float: ...
def betavariate(self, alpha: float, beta: float) -> float: ...
def expovariate(self, lambd: float) -> float: ...
def gammavariate(self, alpha: float, beta: float) -> float: ...
def gauss(self, mu: float, sigma: float) -> float: ...
def lognormvariate(self, mu: float, sigma: float) -> float: ...
def normalvariate(self, mu: float, sigma: float) -> float: ...
def vonmisesvariate(self, mu: float, kappa: float) -> float: ...
def paretovariate(self, alpha: float) -> float: ...
def weibullvariate(self, alpha: float, beta: float) -> float: ...

1 Answers1

0

I'm assuming you're looking at some interface code by some third party app. See: What does "i" represent in Python .pyi extension?

For the actual source code: https://github.com/python/cpython/blob/master/Lib/random.py