Re:The different uses of Python type hints
by BeefySwain on Saturday April 15, 2023 @08:15PM
(#35585963)
Great catch, how could I forget!
Re:The different uses of Python type hints
by auscompgeek on Saturday April 15, 2023 @10:55PM
(#35586843)
Variable annotations were only added in Python 3.6. Defining a typed namedtuple in Python 3.5 looked like this:
Foo = typing.NamedTuple('Foo', [('a', int), ('b', str)])
FWIW, `typing.NamedTuple` did this in Python 3.5, three years before dataclasses was introduced in 3.7.