from typing import NamedTuple
from functools import cached_property
class NT(NamedTuple):
a: int
b: int
@property
def primefactors_a(self):
n = self.a
if n < 2:
return []
factors = []
d = 2
while d
Подробнее здесь: [url]https://stackoverflow.com/questions/79830653/caching-derived-properties-of-namedtuple[/url]