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.

-Barry

On Sat, Jan 8, 2022, at 03:06, Stéfane Fermigier wrote:
> 
> On 8 Jan 2022 at 00:59:38, jack.jan...@cwi.nl 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?
> 
> Indeed. 
> 
> 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): …
> 
> or
> 
> 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.
> 
>   S.
> 
> -- 
> Stefane Fermigier - http://fermigier.com/ - http://twitter.com/sfermigier - 
> http://linkedin.com/in/sfermigier
> Founder & CEO, Abilian - Enterprise Social Software - http://www.abilian.com/
> Co-Founder & Co-Chairman, National Council for Free & Open Source Software 
> (CNLL) - http://cnll.fr/
> Co-Founder & Chairman, Association Professionnelle Européenne du Logiciel 
> Libre (APELL) - https://www.apell.info/
> Co-Founder & Spokesperson, European Cloud Industrial Alliance (EUCLIDIA) - 
> https://www.euclidia.eu/ 
> Founder, PyParis & PyData Paris - http://pyparis.org/ & http://pydata.fr/
> _______________________________________________
> Python-Dev mailing list -- python-dev@python.org
> To unsubscribe send an email to python-dev-le...@python.org
> https://mail.python.org/mailman3/lists/python-dev.python.org/
> Message archived at 
> https://mail.python.org/archives/list/python-dev@python.org/message/PDRKIUCGM257VRZCPGBVB2LN34XAIZZR/
> Code of Conduct: http://python.org/psf/codeofconduct/
> 
_______________________________________________
Python-Dev mailing list -- python-dev@python.org
To unsubscribe send an email to python-dev-le...@python.org
https://mail.python.org/mailman3/lists/python-dev.python.org/
Message archived at 
https://mail.python.org/archives/list/python-dev@python.org/message/AYELXS66CTVDQR5QMIWRSCVGCEJ63M7X/
Code of Conduct: http://python.org/psf/codeofconduct/

Reply via email to