import headaches/gripes

Gordon McMillan gmcm at hypernet.com
Sat Mar 10 19:53:33 EST 2001


pearu at cens.ioc.ee (Pearu Peterson) wrote:

>
>On Sat, 10 Mar 2001, Paul Prescod wrote:
>
>> I think there are two reasons:
>> 
>>  1. Even checking file dates has a performance cost. It involves going
>> to the hard disk after all. Code like this isn't rare in Python
>
>I think this is not true in Linux where recently read files stay in
>memory buffer so that later access to the files does not involve
>(physical) actions on the hard disk. Don't know if Windows has such a
>feature..

Windows caches that stuff too. But Linux doesn't cache everything you need 
to do this:

 for dir in sys.path:
    for ext in ('.py', '.pyc') + c_extensions:
        testnm = os.path.join(dir, modulename) + ext
        if os.path.exists(testnm):
           .....

so Paul's point stands.

- Gordon



More information about the Python-list mailing list