On Mon, Aug 8, 2016 at 11:17 PM, Greg Ewing <greg.ew...@canterbury.ac.nz> wrote:
> אלעזר 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? Correct, but we can invent a new base class that has these semantics. It's no different from Enum. Anyway, I think this will have to be an add-on to be designed after the basics are done. -- --Guido van Rossum (python.org/~guido)
_______________________________________________ Python-ideas mailing list Python-ideas@python.org https://mail.python.org/mailman/listinfo/python-ideas Code of Conduct: http://python.org/psf/codeofconduct/