Skip to content

Commit

Permalink
[return-arg-in-generator] Add a details.rst only as the message is no…
Browse files Browse the repository at this point in the history
…t raised anymore
  • Loading branch information
Pierre-Sassoulas committed Aug 9, 2023
1 parent 2c6239e commit 100eeab
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 0 deletions.
16 changes: 16 additions & 0 deletions doc/data/messages/r/return-arg-in-generator/details.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
This is a message that isn't going to be raised for python > 3.3. It was raised
for code like::

def interrogate_until_you_find_jack(pirates):
for pirate in pirates:
if pirate == "Captain Jack Sparrow":
return "Arrr! We've found our captain!"
yield pirate

Which is now valid and equivalent to the previously expected::

def interrogate_until_you_find_jack(pirates):
for pirate in pirates:
if pirate == "Captain Jack Sparrow":
raise StopIteration("Arrr! We've found our captain!")
yield pirate
2 changes: 2 additions & 0 deletions doc/data/messages/r/return-arg-in-generator/related.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
- `PEP380 <https://peps.python.org/pep-0380/>`_
- `Stackoverflow explanation <https://stackoverflow.com/a/16780113/2519059>`_

0 comments on commit 100eeab

Please sign in to comment.