Python's list equivalent with std.variant?

Imperatorn johan_forsberg_86 at
Sun Oct 3 22:48:47 UTC 2021

On Sunday, 3 October 2021 at 22:22:48 UTC, rjkilpatrick wrote:
> Hi.
> I am trying to emulate Python's list in D, to store some 
> derived classes
> [...]

You would have to explicitly cast(Variant) when appending to your 

But in the last example where you have list[0].a, that will only 
work statically if you can resolve that property. So you would 
have to either check the type or get out of the box and use some 
dynamic object

More information about the Digitalmars-d-learn mailing list