[Python-ideas] Trial balloon: adding variable type

Guido van Rossum guido at python.org
Wed Aug 3 14:03:54 EDT 2016


On Wed, Aug 3, 2016 at 10:52 AM, אלעזר <elazarg at gmail.com> wrote:
>> Date: Wed, 3 Aug 2016 09:11:42 -0700
>> From: Guido van Rossum <guido at python.org>
>>
>> ... It would be much cleaner if you could declare the
>> variable before the first `if`. But picking a good initializer is
>> tricky, especially if you have a type that does not include None.
>
> PEP-484 suggests ellipsis for this.

But

  x = ...

already has a meaning -- it assigns x the (fairly pointless) value
Ellipsis (which is a singleton object like None).

-- 
--Guido van Rossum (python.org/~guido)


More information about the Python-ideas mailing list