Fredrik Lundh wrote: > you do realize that this opens the file again every time, so you end > up having 4x2500 file handles pointing to 4 physical files. that's a > bad idea. > Assuming he is using the common C Python most of those file handles get closed immediately after opening, so he never actually has more than 5 handles open at one time. Even 5 open handles to 4 physical files is a bad idea though, and depending on this behaviour is also a bad idea.
If he had actually managed to try to open all the files simultaneously then I think an exception would be quite likely with anything approaching that number of handles e.g. on my XP system I can open 509 handles (or 3 more if I close stdin/out/err first) and just over twice that on Linux. -- http://mail.python.org/mailman/listinfo/python-list