[Python-ideas] Trial balloon: adding variable type declarations in support of PEP 484

Chris Angelico rosuav at gmail.com
Mon Aug 1 17:40:39 EDT 2016


On Tue, Aug 2, 2016 at 7:31 AM, Guido van Rossum <guido at python.org> wrote:
> I'd like to address this in the future, and I think the most elegant
> syntax would be to let you write these as follows:
>
> a: float = 0
> b: List[int] = []
> c: Optional[str] = None
>
> There are some corner cases to consider.

Additional case, unless it's patently obvious to someone with more 484
experience than I: what happens with chained assignment?

a = b = c = 0

Does each variable get separately tagged, or does one tag apply to all?

ChrisA


More information about the Python-ideas mailing list