I'm struggling with the following piece of code:
def function(param):
if(param == 'notgen'):
return 'some text'
elif(param == 'gen'):
for x in range(10):
yield x
gen = function('notgen')
print(type(gen))
>>> <class 'generator'>
I suppose, this is expected behavior, but I cannot find proper docs. I need to yield and return values from one function depending on the situation. Is it even doable?
Thanks everybody for suggestions!