Skip to content

Instantly share code, notes, and snippets.

Avatar

Keyacom

View GitHub Profile
@Keyacom
Keyacom / none_awareness.py
Last active September 17, 2022 14:40
None-aware functions (for PEP 505 being deferred)
View none_awareness.py
"""
A way the proposed ``??``, ``?.`` and ``?[`` operators could be implemented.
For now, this lacks an implementation for ``??=``.
"""
from __future__ import annotations
from types import NoneType
from typing import Hashable, NamedTuple