Le jeudi 17 décembre 2015 à 15:16 -0800, amik...@gmail.com a écrit : > This reply is on a new thread but since you mentioned the solution > with duck-typing, of which I was aware, I have a related question. > Assuming I know that this function will be applied to only types T1 > or T2, is it better to use the second solution with Union in terms of > performance? I would assume so but am no expert in this field... No, type annotations do not make any performance difference here. They simply restrict the types that a caller can pass, that's all.
Regards