In Python, I can do this: my_obj = Obj() string_from_func = func() setattr(my_obj, string_from_func, 100)
Say func() returns "member1" or "member2", the setattr would then set either one of those to 100.
Is there any equivalent in D?
Jack Stouffer via Digitalmars-d-learn Mon, 29 Feb 2016 21:11:12 -0800
In Python, I can do this: my_obj = Obj() string_from_func = func() setattr(my_obj, string_from_func, 100)
Say func() returns "member1" or "member2", the setattr would then set either one of those to 100.
Is there any equivalent in D?