Calling a C program from a Python Script

Brad Tilley bradtilley at gmail.com
Thu Dec 9 14:03:42 EST 2004


Steven Bethard wrote:
>>> for root, files, dirs in os.walk(path)
>>>      for f in files:
>>>          try:
>>>              x = file(f, 'rb')
>>>              data = x.read()
>>>              x.close()
> 
> 
> Remember that CPython is implemented in C, and so all the builtin types 
> (including file) basically execute C code directly.  My experience with 
> Python file objects is that they are quite fast when you're doing simple 
> things like the example above.

I'm dealing with a terabyte of files. Perhaps I should have mentioned that.



More information about the Python-list mailing list