Questions/issues regarding generators

Andreas Rossberg rossberg at google.com
Thu Mar 7 08:56:54 PST 2013


On 7 March 2013 17:50, Kevin Reid <kpreid at google.com> wrote:
> Use of a singleton (or not marked for the specific generator) sentinel
> object has a hazard: the sentinel is then a magic value which cannot be
> safely processed by library code written to operate on arbitrary values,
> which happens to use generators in its implementation.

While that is true, it is conceptually no different from using a magic
exception value, as under the current proposal. That clobbers use of
that value for the exceptional return path in exactly the same way as
the proposed alternative does for the regular return path. The only
way to avoid both (in a single-function protocol) is the approach
Claus mentioned.

/Andreas


More information about the es-discuss mailing list