It's just None !
>>> def nothing(nun: None) -> None: ... return nun ... >>> nothing(None) >>>
Or at least it could be.
Since these annotations are not relevant to Python outside of / the correct syntax, this is similar to tools.
If you use typecheck-decorator , then you will need to use type(None) :
>>> import typecheck as tc >>> >>> @tc.typecheck >>> def nothing(nun: type(None)) -> type(None): ... return nun ... >>> nothing(None) >>> nothing(0) typecheck.framework.InputParameterError: nothing() has got an incompatible value for nun: 0 >>> nothing(False) typecheck.framework.InputParameterError: nothing() has got an incompatible value for nun: False
Typecheck also allows you to more clearly "add more than one type of hint" using tc.any() (OR), tc.all() (AND) and, moreover, moreover.
Beware that tc.none() is a NAND-like predicate; not what you are looking for - with no arguments, it will accept any type equivalent to tc.all() or more apt tc.anything .
source share