Skip to content

Conversation

@AnonymDevOSS
Copy link

The loop never uses break, so the else clause always executes. However, since it iterates over a generator, the generator is already exhausted after the first pass... so the else block would iterate over nothing.

So, i believe the 'else' is redundant.

Type of change

Please delete options that are not relevant.

  • Bug fix (non-breaking change which fixes an issue)

How has this change been tested, please provide a testcase or example of how you tested the change?

>>> def g():
...   for x in range(3):
...     yield x
... 
>>> gen = g()
>>> for x in gen:
...   print(x)
... else:
...   for y in gen:
...     print("y", y)
... 
0
1
2

Any specific deployment considerations

For example, documentation changes, usability, usage/costs, secrets, etc.

Docs

  • Docs updated? What were the changes:

@CLAassistant
Copy link

CLAassistant commented Oct 26, 2025

CLA assistant check
All committers have signed the CLA.

The loop never uses break, so the else clause always executes.
However, since it iterates over a generator, the generator is already exhausted after the first pass... so the else block would iterate over nothing.

So, i believe the 'else' is redundant.
@AnonymDevOSS AnonymDevOSS force-pushed the fix/process-video-else-bug branch from 482af26 to 5b9cbeb Compare October 28, 2025 12:55
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants