[Python-ideas] Trial balloon: adding variable type declarations in support of PEP 484
Greg Ewing
greg.ewing at canterbury.ac.nz
Tue Aug 9 02:17:49 EDT 2016
אלעזר wrote:
> class Starship(tuple):
> damage: int = 0
> captain: str = "Kirk"
>
> Is an obvious syntax for
>
> Starship = NamedTuple('Starship', [('damage', int), ('captain', str)])
But the untyped version of that already has a meaning --
it's a tuple subclass with two extra class attributes
that are unrelated to its indexable items.
I thought that type annotations weren't meant to change
runtime semantics?
--
Greg
More information about the Python-ideas
mailing list