by baq · 2y ago · 0 comments
It would feel a lot better if it was this, for example, where you use each context explicitly:
from diagrams import Diagram
from diagrams.aws.compute import EC2
with Diagram("Simple Diagram") as d:
d.add(EC2("web"))
As as the parent also suggests, this then doesn't really need the context management at all from diagrams import Diagram
from diagrams.aws.compute import EC2
d = Diagram("Simple Diagram")
d.add(EC2("web")) d.add(first)
d.add(second)
d.add(...)
you see redundancy and a misused language capability, I see a feature and a nice DSL.