Sep-19-2021, 12:20 AM
what is the appropriate pythonic way for a function to detect that a generator is passed to it? i can do this:
if type(arg).__name__=='generator': print('got a generator') else: print('did not get a generator')i cannot do:
if isinstance(arg,generator): print('got a generator') else: print('did not get a generator')because
generator
is not defined.
Tradition is peer pressure from dead people
What do you call someone who speaks three languages? Trilingual. Two languages? Bilingual. One language? American.
What do you call someone who speaks three languages? Trilingual. Two languages? Bilingual. One language? American.