0
def f(gateType = 'AND', input = 'A'):
(ab, delay) = {
'AND': ({'A': (a,b), 'B': (c,d)}, delay1),
'OR': ({'A': (x,y), 'B': (k,l)}, delay2),
('INV': {'A': (g,h)}, delay3)
}[gateType]
(a,b) = ab[input]
Here, I used two steps to reach to a and b. I would prefer to have (a,b,del...