Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/uriyyo/typed-undefined

🐒 smth like JS undefined but in Python
https://github.com/uriyyo/typed-undefined

python python-typing python-utilities typing

Last synced: 17 days ago
JSON representation

🐒 smth like JS undefined but in Python

Awesome Lists containing this project

README

        

# Typed Undefined

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

```python
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:

```buildoutcfg
[mypy]
plugins = undefined.mypy
```