Re: [IronPython] Writing a Python iterator in C#?

2010-05-09 Thread Jeff Hardy
On Fri, Apr 30, 2010 at 4:31 PM, Jeff Hardy wrote: > On Fri, Apr 30, 2010 at 4:19 PM, Dino Viehland 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

Re: [IronPython] Writing a Python iterator in C#?

2010-04-30 Thread Dino Viehland
Jeff wrote: > On Fri, Apr 30, 2010 at 4:19 PM, Dino Viehland 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 > > en

Re: [IronPython] Writing a Python iterator in C#?

2010-04-30 Thread Jeff Hardy
On Fri, Apr 30, 2010 at 4:19 PM, Dino Viehland 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

Re: [IronPython] Writing a Python iterator in C#?

2010-04-30 Thread Dino Viehland
Jeff wrote: > I'm trying to implement a Python iterator in C# without also > implementing IEnumerator/IEnumerable (I'm also assuming it's even > possible, of course). When trying to use the class in a for loop (`cu` > is a Cursor instance): > > >>> for row in cu: > print cu > > TypeErro

[IronPython] Writing a Python iterator in C#?

2010-04-30 Thread Jeff Hardy
I'm trying to implement a Python iterator in C# without also implementing IEnumerator/IEnumerable (I'm also assuming it's even possible, of course). When trying to use the class in a for loop (`cu` is a Cursor instance): >>> for row in cu: print cu TypeError: Unable to cast object of ty