In Python 2 it used to cause an error when return occurred together with yield inside a function definition. But for this code in Python 3.3:
def f():
  return 3
  yield 2
  
x = f()
print(x.__next__())
there is no error that return is used in function with yield. However when the function __next__ is called then there is thrown exception StopIteration. Why there is not just returned value 3? Is this return somehow ignored?
 
     
     
    