Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
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
- Host: GitHub
- URL: https://github.com/uriyyo/typed-undefined
- Owner: uriyyo
- License: mit
- Created: 2021-02-11T13:19:15.000Z (almost 4 years ago)
- Default Branch: master
- Last Pushed: 2022-04-10T08:42:32.000Z (over 2 years ago)
- Last Synced: 2024-10-10T19:08:16.638Z (about 1 month ago)
- Topics: python, python-typing, python-utilities, typing
- Language: Python
- Homepage:
- Size: 85 KB
- Stars: 3
- Watchers: 2
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
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, resolvedef foo(bar: Undefined[int] = undefined) -> int:
return resolve(undefined, 10)foo(1) # ok
foo(1.0) # errora: 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
```