You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: text/0000-gen-fn.md
+34-14Lines changed: 34 additions & 14 deletions
Original file line number
Diff line number
Diff line change
@@ -214,23 +214,43 @@ def odd_dup(values):
214
214
- What parts of the design do you expect to resolve through the implementation of this feature before stabilization?
215
215
- What related issues do you consider out of scope for this RFC that could be addressed in the future independently of the solution that comes out of this RFC?
216
216
217
+
## Panicking
218
+
219
+
What happens when a `gen` block that panicked gets `next` called again? Do we need to poison the iterator?
220
+
221
+
## Fusing
222
+
223
+
Are `gen` blocks fused? Or may they behave eratically after returning `None` the first time?
224
+
217
225
# Future possibilities
218
226
[future-possibilities]: #future-possibilities
219
227
220
-
Think about what the natural extension and evolution of your proposal would
221
-
be and how it would affect the language and project as a whole in a holistic
222
-
way. Try to use this section as a tool to more fully consider all possible
223
-
interactions with the project and language in your proposal.
224
-
Also consider how this all fits into the roadmap for the project
225
-
and of the relevant sub-team.
228
+
## `yield from` (forwarding operation)
229
+
230
+
Python has the ability to `yield from` an iterator.
231
+
Effectively this is syntax sugar for looping over all elements of the iterator and yielding them individually.
232
+
There are infinite options to choose from if we want such a feature, so I'm just going to list the general ideas below:
226
233
227
-
This is also a good place to "dump ideas", if they are out of scope for the
228
-
RFC you are writing but otherwise related.
234
+
### Do nothing, just use loops
235
+
236
+
```rust
237
+
forxiniter {
238
+
yieldx
239
+
}
240
+
```
229
241
230
-
If you have tried and cannot think of any future possibilities,
231
-
you may simply state that you cannot think of anything.
242
+
### language support
232
243
233
-
Note that having something written down in the future-possibilities section
234
-
is not a reason to accept the current or a future RFC; such notes should be
235
-
in the section on motivation or rationale in this or subsequent RFCs.
236
-
The section merely provides additional information.
244
+
we could do something like postfix `yield` or an entirely new keyword, or...
245
+
246
+
```rust
247
+
iter.yield
248
+
```
249
+
250
+
### stlib macro
251
+
252
+
We could add a macro to the standard library and prelude, the macro would just expand to the for loop + yield.
0 commit comments