Damian Vuleta schrieb am 10.09.2015 um 07:13:
> Another newbie question…
>
> I have a Cython module that has two functions.
>
> One is a generator with a Yield method (producing a list) within a 'While
> 1' loop, so it may be always callable.
>
> The other is a loop that repeatedly calls on the generator. An iterator
> variable is created:
>
> gen = generatorfunction(mem)
>
> *# mem is the input, a memoryview*
>
> and successive results are called via 'next(gen)' as required.
>
> Should the iterator variable 'gen' have a type? And what would it be? Or
> should I leave it as an uptyped Python object?
No need for typing here. Remember that Cython is an *optionally* typed
language. As long as there is no reason to declare the type of a variable
(such as your profiler hitting you on the fingers), just keep your code in
Python.
Stefan