[Tutor] Importing question
Alan Gauld
alan.gauld at btinternet.com
Fri Jul 13 23:50:35 CEST 2007
"Dick Moores" <rdm at rcblue.com> wrote in
> import itertools
>
> def iter_primes():
> # an iterator of all numbers between 2 and +infinity
> numbers = itertools.count(2)
> ...
> It works for me in Win XP, Python 2.5.
>
> However, in trying to dig into the code to understand it,
> I'm not able to find itertools.py,
Thats because its a compiled C module not implemented
in Python. You probably won't find a sys.py either.
If you do
>>> print itertools
<module 'itertools' (built-in)>
You'll see its actually built-in.
So you need to look at the C source to see how it is written!
Alan G
More information about the Tutor
mailing list