[IronPython] Writing a Python iterator in C#?
dinov at microsoft.com
Fri Apr 30 15:34:37 PDT 2010
> On Fri, Apr 30, 2010 at 4:19 PM, Dino Viehland <dinov at microsoft.com> wrote:
> > That's definitely a bug. We usually check for the interfaces first and
> > we have a code path that's assuming we have a user-defined object when
> > we're not an enumerable/enumerator but we have __iter__. It's easy
> > enough to fix we're just trying to generate optimal code for getting
> > the Python type of an object.
> I'll file an issue.
> > Is there a reason you can't implement IEnumerator/IEnumerable?
> I'd like to reuse my existing next() method to do that (it's really
> complicated), but it requires a CodeContext - which I can't pass to
> GetEnumerator(), AFAIK.
Oh, bummer... Can you have the instance hold onto the code context when
it gets created? That might be a reasonable workaround for the time
More information about the Users