✊🏿 Black Lives Matter. Please consider donating to Black Girls Code today.
🐇 Announcing Dash VTK for 3d simulation graphics. Check out the March webinar.

Better solution for updating layout with dynamic dict keys?

The original method to update layout works. How can I change key (yaxis3) dynamically? I tried the following methods.
Method A:
fig[“layout”].update(yaxis3=dict(overlaying=“y1”))

Method B: # this doesn’t work
n_trace = 3
fig[“layout”].update([(f"yaxis{n_trace}", dict(overlaying=“y1”))])

Method C:
def trans(input_str):
return input_str
n_trace = 3
fig[“layout”].update({trans(f"yaxis{n_trace}"): dict(overlaying=“y1”)})

Method C works. But, is there any better solution?