[Python-Dev] Please reject or postpone PEP 526

Koos Zevenhoven k7hoven at gmail.com
Sun Sep 4 12:58:50 EDT 2016


On Sun, Sep 4, 2016 at 7:43 PM, Nick Coghlan <ncoghlan at gmail.com> wrote:
> On 4 September 2016 at 21:32, Ivan Levkivskyi <levkivskyi at gmail.com> wrote:
>> The first form still could be interpreted by type checkers
>> as annotation for value (a cast to more precise type):
>>
>> variable = cast(annotation, value) # visually also looks similar
>
> I think a function based spelling needs to be discussed further, as it
> seems to me that at least some of the goals of the PEP could be met
> with a suitable definition of "cast" and "declare", with no syntactic
> changes to Python. Specifically, consider:
>
>     def cast(value, annotation):
>         return value
>

typing.cast already exists.

-- Koos


More information about the Python-Dev mailing list