Rule Definition
Mixing return with value and yield in the same function could lead to technical complexity. Based on the version used to run the Python script (2.x, 3.3, 3.4 for example), the results will not be the same.
Remediation
Try to avoid return with value statements within functions containing yield.
Violation Code Sample
>>> def generator1(n):
>>> for i in range(n):
>>> yield i
>>> return 0
Related Technologies
Technical Criterion
Complexity - Technical Complexity
About CAST Appmarq
CAST Appmarq is by far the biggest repository of data about real IT systems. It's built on thousands of analyzed applications, made of 35 different technologies, by over 300 business organizations across major verticals. It provides IT Leaders with factual key analytics to let them know if their applications are on track.