Mypy: Is there a way to represent an empty tuple type?

Created on 6 Nov 2017  路  4Comments  路  Source: python/mypy

logging.handlers.SMTPHandler arg secure accepts something like this:

Union[EmptyTuple, Tuple[str], Tuple[str, str]]

Is there a way to define the EmptyTuple part?

documentation priority-1-normal

Most helpful comment

Should be Tuple[()]

All 4 comments

Should be Tuple[()]

@elazarg thanks!

I did not find any documentation of this, so it would be nice to add that.

True, the only mention of Tuple[()] is in PEP 484.

Was this page helpful?
0 / 5 - 0 ratings