From 29e9a0e0d2ea2644c202641afcb58b38e6653397 Mon Sep 17 00:00:00 2001 From: Pierre Sassoulas Date: Sun, 5 Feb 2023 14:30:04 +0100 Subject: [PATCH] [return-arg-in-generator] Add a details.rst only as the message is not raised anymore --- .../r/return-arg-in-generator/details.rst | 16 ++++++++++++++++ .../r/return-arg-in-generator/related.rst | 2 ++ 2 files changed, 18 insertions(+) create mode 100644 doc/data/messages/r/return-arg-in-generator/details.rst create mode 100644 doc/data/messages/r/return-arg-in-generator/related.rst diff --git a/doc/data/messages/r/return-arg-in-generator/details.rst b/doc/data/messages/r/return-arg-in-generator/details.rst new file mode 100644 index 0000000000..2614f927e7 --- /dev/null +++ b/doc/data/messages/r/return-arg-in-generator/details.rst @@ -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 diff --git a/doc/data/messages/r/return-arg-in-generator/related.rst b/doc/data/messages/r/return-arg-in-generator/related.rst new file mode 100644 index 0000000000..aba86a21b8 --- /dev/null +++ b/doc/data/messages/r/return-arg-in-generator/related.rst @@ -0,0 +1,2 @@ +- `PEP380 `_ +- `Stackoverflow explanation `_