look at the following code, I would like to know why the my_func doesn't return the "5". I know that if I remove the else statement It will work, but I would like to know what is happening, any doc or post that explain it?
def my_func(value):
if value == 5:
return 5
else:
yield from range(value)
print(my_func(5))