PEP 570: Python Positional-Only Parameters

Another thing worth mentioning about per-argument syntax is that currently mypy (and likely some other type checkers) use double underscore to indicate positional-only arguments. This is currently used mostly in stub files because one can currently only define positional-only arguments in C modules.

I don’t have strong preference, but I like this syntax more. The / looks a bit cryptic, while __arg has a precedent as “private” attributes. This is kind of similar to arguments being “anonymous”.

2 Likes