From: alexey.muranov@... Date: 2016-02-07T20:23:44+00:00 Subject: [ruby-core:73735] [CommonRuby Feature#12057] Allow methods with `yield` to be called without a block Issue #12057 has been reported by Alexey Muranov. ---------------------------------------- Feature #12057: Allow methods with `yield` to be called without a block https://bugs.ruby-lang.org/issues/12057 * Author: Alexey Muranov * Status: Open * Priority: Normal * Assignee: ---------------------------------------- Trying to figure out how `yield` works in Python, i had the following idea. Allow a method with `yield` to be called without a block. When a method encounters `yield`, if no block is given, the method returns an `Enumerator` object. ~~~ruby def f yield 'a' yield 'b' end e = f puts e.next # => a puts e.next # => b ~~~ It seems that this is what `yield` in Python does, but in Python a function with `yield` cannot take a block. Why not to have both? -- https://bugs.ruby-lang.org/ Unsubscribe: