You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I have a function that returns different types coming from elsewhere. In C++ I could declare such function and call it as follows.
template <typename T> T fn();
int i = fn<int>();
constchar *cp = fn<constchar*>();
I'm trying to achieve similar behavior in Python with this code. Would this be the intended way to do so or there is a more straightforward way to call a generic function with an explicit type in Python?
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
-
I have a function that returns different types coming from elsewhere. In C++ I could declare such function and call it as follows.
I'm trying to achieve similar behavior in Python with this code. Would this be the intended way to do so or there is a more straightforward way to call a generic function with an explicit type in Python?
Thanks
Beta Was this translation helpful? Give feedback.
All reactions