Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions doc/data/messages/y/yield-outside-function/bad.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
for i in range(10):
yield i # [yield-outside-function]
6 changes: 6 additions & 0 deletions doc/data/messages/y/yield-outside-function/good.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
def get_values(data):
yield from data


for i in get_values(range(10)):
pass
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
def get_values(data):
yield from data
for i in get_values(range(10)):
pass
def get_values(data):
for i in range(10):
yield i

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ha sorry I made the same comment 😄

Comment thread
Pierre-Sassoulas marked this conversation as resolved.
Outdated