On Jun 13, 5:40 pm, [EMAIL PROTECTED] wrote: > Hi all, > > I am running Python 2.5 on Feisty Ubuntu. I came across some code that > is substantially slower when in a method than in a function. > > >>> cProfile.run("bar.readgenome(open('cb_foo'))") > > 20004 function calls in 10.214 CPU seconds
> >>> cProfile.run("z=r.readgenome(open('cb_foo'))") > > 20004 function calls in 0.041 CPU seconds > I suspect open files are cached so the second reader picks up where the first one left: at the of the file. The second call doesn't do any text processing at all. -- Leo -- http://mail.python.org/mailman/listinfo/python-list