Is it possible to combine two (or more) class declarations into one?
This should be similar to multiple inheritance I guess, but should work with slots.
For example:
@define
class Point2d:
x : int
y : int
@define
class Line:
start : Point2d
end : Point2d
@define
class StrokeProperties:
size : float
color : Color
DrawnPoint = some_magic(Point2d, StrokeProperties)
DrawnLine = some_magic(Line, StrokeProperties)
print(DrawnPoint.x, DrawnPoint.size)
One could argue, that composition should be used instead, but I think it could be nicer to be able to access attributes without nesting.
Is there something like this in attrs, or how it could be done using existing api?
Is it possible to combine two (or more) class declarations into one?
This should be similar to multiple inheritance I guess, but should work with slots.
For example:
One could argue, that composition should be used instead, but I think it could be nicer to be able to access attributes without nesting.
Is there something like this in attrs, or how it could be done using existing api?