Serhiy Storchaka <storchaka+cpyt...@gmail.com> added the comment:
What about mix-ins or abstract base classes? class VecMixin: def length(self): return math.hypot(*self) class Vec2D(NamedTuple, VecMixin): x: float y: float class Vec3D(NamedTuple, VecMixin): x: float y: float z: float Currently you need to use the following trick to get a similar result: class Vec2D(NamedTuple): x: float y: float class Vec2D(Vec2D, VecMixin): pass ---------- _______________________________________ Python tracker <rep...@bugs.python.org> <https://bugs.python.org/issue43923> _______________________________________ _______________________________________________ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com