-
-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[return-arg-in-generator] Add a details.rst only as the message is no…
…t raised anymore
- Loading branch information
1 parent
2c6239e
commit 100eeab
Showing
2 changed files
with
18 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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>`_ |