Message323298
Example:
from typing import NamedTuple
from dataclasses import dataclass, asdict
class NamedTupleAttribute(NamedTuple):
example: bool = True
@dataclass
class Data:
attr1: bool
attr2: NamedTupleAttribute
data = Data(True, NamedTupleAttribute(example=True))
namedtuple_attr = asdict(data)['attr2']
print(type(namedtuple_attr.example))
>>> generator
One would expect that the printed type would be of type bool. |
|
Date |
User |
Action |
Args |
2018-08-08 19:41:25 | alexdelorenzo | set | recipients:
+ alexdelorenzo |
2018-08-08 19:41:25 | alexdelorenzo | set | messageid: <1533757285.89.0.56676864532.issue34363@psf.upfronthosting.co.za> |
2018-08-08 19:41:25 | alexdelorenzo | link | issue34363 messages |
2018-08-08 19:41:25 | alexdelorenzo | create | |
|