Skip to content

pfun.Intersection

Abstract type that represents the intersection between two or more protocols when using the pfun MyPy plugin.

Only protocols can be used as arguments to Intersection.

Examples:

>>> from typing import Protocol
>>> class P1(Protocol):
...     x: str
>>> class P2(Protocol):
...     y: int
>>> i: Intersection[P1, P2]
>>> class C:
...     x: str
>>> i = C()  # MyPy error

pfun.DefaultModules

Module provider that provides live implementations of default pfun modules.

Examples:

>>> from pfun import console, random, DefaultModules
>>> random.random().and_then(console.print).run(DefaultModules())
0.51351531

Attributes:

Name Type Description
files files.Files

The files module

console console.Console

The console module

random random.Random

The random module

clock clock.Clock

the clock module