[Tutor] Importing question
rdm at rcblue.com
Sat Jul 14 01:18:59 CEST 2007
At 02:50 PM 7/13/2007, Alan Gauld wrote:
>"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!
>>> import math
>>> print math
<module 'math' (built-in)>
More information about the Tutor