FAQ
Here is a simple idea to make generators more useful for some applications,
although I won't for now name them..
anyways, advantage of current generators was not too obvious for all the
people, too.

So, currently the interface between generator and it's user program is rather
poor, because it only consists of a signal from a user routine, and a kind
of only one directional data passage - from the generator.
This seems unsymmetric to me, and thus incomplete..
What I think should increase the potential usefulness of a generators,
is bi-directional data passage. This is very easy to implement, IMHO.

What needs to be done is to allow yield return something - whatever was
passed to the .next() thing from caller..
Easy and obvious, isn't it? So is there any principal problem with this
idea that would prevents its implementation?

I understand that this can be achieved by using some
global, for instance, but hey, I used to implement generator's functionality
without using them, too - just make a class and make
algorithm look horrible. The same thing, but much wordier and uglier
looking... and that does not mean that generators are redundant.

Search Discussions

Discussion Posts

Previous

Follow ups

Related Discussions

Discussion Navigation
viewthread | post
posts ‹ prev | 2 of 7 | next ›
Discussion Overview
grouppython-list @
categoriespython
postedAug 19, '03 at 8:07a
activeAug 20, '03 at 5:27a
posts7
users5
websitepython.org

People

Translate

site design / logo © 2022 Grokbase