On Thu, Oct 24, 2013 at 05:21:56PM +0000, Dave Angel wrote:

> If you
> want a surprise, try the following simple program some time.
> 
> import sys
> print(sys.modules)
> 
> when I tried that interactively on 2.7, it printed some 240+ names.

Wow. What were you doing? Ah, I bet you had imported numpy or similar! 
numpy brings in a lot.

[steve@ando ~]$ python2.7 -c "import sys, numpy; print len(sys.modules)"
233


Here are the results you get with a freshly-started Python interpreter 
on Linux, for various versions of Python, excluding numpy. Starting with 
ancient Python 1.5, and going right up the most recent 3.4 alpha 
version.


[steve@ando ~]$ python1.5 -c "import sys; print len(sys.modules)"
12
[steve@ando ~]$ python2.4 -c "import sys; print len(sys.modules)"
29
[steve@ando ~]$ python2.5 -c "import sys; print len(sys.modules)"
27
[steve@ando ~]$ python2.6 -c "import sys; print len(sys.modules)"
30
[steve@ando ~]$ python2.7 -c "import sys; print len(sys.modules)"
39
[steve@ando ~]$ python3.2 -c "import sys; print(len(sys.modules))"
52
[steve@ando ~]$ python3.3 -c "import sys; print(len(sys.modules))"
54
[steve@ando ~]$ python3.4 -c "import sys; print(len(sys.modules))"
34

And a few others:

steve@orac:~$ jython -c "import sys; print len(sys.modules)"
31
steve@orac:~$ ipy -c "import sys; print len(sys.modules)"
21
steve@orac:~$ ipython -c "import sys; print len(sys.modules)"
269


ipython also brings in a lot of modules, even more than numpy. Oooh, now 
there's a thought!

steve@orac:~$ ipython -c "import sys, numpy; print len(sys.modules)"
397


-- 
Steven
_______________________________________________
Tutor maillist  -  Tutor@python.org
To unsubscribe or change subscription options:
https://mail.python.org/mailman/listinfo/tutor

Reply via email to