[IronPython] Writing a Python iterator in C#?

Jeff Hardy jdhardy at gmail.com
Sat May 1 00:31:04 CEST 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.

- Jeff



More information about the Ironpython-users mailing list