[Cython] __next__ | not being able to use cpdef
Aaron DeVore
aaron.devore at gmail.com
Tue Dec 9 00:31:07 CET 2008
If there's an internal Python/extension type data structure you could
use the iterator from that.
class Foo:
def __init__(self):
self.var = []
def __iter__(self):
return iter(self.var)
Besides that I can't think of anything.
-Aaron
On Mon, Dec 8, 2008 at 2:24 PM, Jelle Feringa <jelleferinga at gmail.com> wrote:
>>> Out of curiosity, would most of the time be spent on the line "return
>>> self.obj[self.i]"? It seems like a __getitem__ call would be much
>>> slower than anything else in the class.
>>
>> Yes, almost certainly.
>
> Hi Aaron, Robert,
>
> Thanks for your response; any suggestion what might be more efficient
> than a __getitem__ call?
> Or is this class doomed by design?
>
> Cheers,
>
> -jelle
> _______________________________________________
> Cython-dev mailing list
> Cython-dev at codespeak.net
> http://codespeak.net/mailman/listinfo/cython-dev
>
More information about the Cython-dev
mailing list