The advantage to users of keeping the languages the same is that readers of your code don’t have to learn two disparate syntaxes to make sense of what they’re reading.  One of Python’s enduring strengths has been its readability.  In many ways, type annotations challenge that, but the trade-off (so far) has been worth it (IMHO).  The trick is to balance the expressability that typing needs with the intuitive understanding of “regular” Python code.

FWIW, this is something I struggled with while on the SC during the Pattern Matching debates.  I think the right balance was found, ultimately.


On Sat, Jan 8, 2022, at 03:06, Stéfane Fermigier wrote:

On 8 Jan 2022 at 00:59:38, wrote:

I posted this suggestion earlier in the callable type syntax discussion, at which point it was completely ignored. Possibly because it’s a really stupid idea, but let me post it again on the off chance that it isn’t a stupid idea but was overlooked. 

If I can make a wild suggestion: why not create a little language for type specifications?


Using the same syntax may have some benefits for language implementors (e.g. less complex grammar to implement), but I don’t really see these benefits for language users.

As an example, and I don’t know if this has been discussed before, I think a pretty neat syntax construct for optional argument would be (like, for instance, in Kotlin):

def f(x: int? = None): ...

Instead of:

def f(x: Optional[int] = None): …


def f(x: int | None = None): …

One could even argue that the “= None” part would be redundant (def f(x: int?): ...)  and could be made optional. But that would open another can of worms.


Founder & CEO, Abilian - Enterprise Social Software -
Co-Founder & Co-Chairman, National Council for Free & Open Source Software (CNLL) -
Co-Founder & Chairman, Association Professionnelle Européenne du Logiciel Libre (APELL) -
Co-Founder & Spokesperson, European Cloud Industrial Alliance (EUCLIDIA) - 
Founder, PyParis & PyData Paris -
Python-Dev mailing list --
To unsubscribe send an email to
Message archived at
Code of Conduct: