Skip to content

Latest commit

History

History
27 lines (17 loc) 路 467 Bytes

README.md

File metadata and controls

27 lines (17 loc) 路 467 Bytes

Typed Undefined

When None is not valid default value you can always use undefined.

from undefined import Undefined, undefined, resolve


def foo(bar: Undefined[int] = undefined) -> int:
    return resolve(undefined, 10)


foo(1)  # ok
foo(1.0)  # error

a: Undefined[int] = 1  # ok
b: Undefined[int] = 0.5  # error

mypy integration

You should add undefined_mypy to list of mypy plugins:

[mypy]
plugins = undefined.mypy