On Sun, Dec 19, 2021 at 8:26 PM Christopher Barker <[email protected]>
wrote:
>
> On 12/18/2021 3:13 PM, Batuhan Taskaya wrote:
>>
>> > tl;dr: I find it very troubling that we are going on a path where need
>> > to increase the language complexity (syntax) only in the cause
>> > 'easier' typing.
>
>
> Which brings up the question is whether it's worth adding syntax for
> typing, but only in the context of typing.
>
The SC has already said we don't like that idea as that bifurcates the
knowledge one needs in order to even have a chance at comprehending a type
hint. Plus PEP 649 wouldn't be possible in that instance unless we ship a
second parser just for type hints in order to translate the type-specific
syntax to type-related objects.
-Brett
> As of right now, typing.get_type_hints() will evaluate a string
> annotation, e.g.
>
> In [62]: def f(x:"int"):
> ...: pass
> ...:
>
> In [63]: typing.get_type_hints(f)
> Out[63]: {'x': int}
>
> so get_type_hints could extend its acceptable syntax with this new use of
> -> -- and it could get used by wrapping it in quotes. And depending on
> how PEP 563 gets resolved, the quotes may not be necessary in the future.
>
> And this could open up some other nifty things, like extending what's
> allowable inside [] -- there was a discussion a while back on python-ideas
> about extending the __getitem__ protocol, partly motivated by type hints.
>
> -CHB
>
> --
> Christopher Barker, PhD (Chris)
>
> Python Language Consulting
> - Teaching
> - Scientific Software Development
> - Desktop GUI and Web Development
> - wxPython, numpy, scipy, Cython
> _______________________________________________
> Python-Dev mailing list -- [email protected]
> To unsubscribe send an email to [email protected]
> https://mail.python.org/mailman3/lists/python-dev.python.org/
> Message archived at
> https://mail.python.org/archives/list/[email protected]/message/JWPMHLSPFTYAYSMWCX7LOXWBEU4FA6DC/
> Code of Conduct: http://python.org/psf/codeofconduct/
>
_______________________________________________
Python-Dev mailing list -- [email protected]
To unsubscribe send an email to [email protected]
https://mail.python.org/mailman3/lists/python-dev.python.org/
Message archived at
https://mail.python.org/archives/list/[email protected]/message/N7HF4FDSPEPJDWFD56NFUPHOEBU4AS7D/
Code of Conduct: http://python.org/psf/codeofconduct/