list.sort(func) speed
Michael Peuser
mpeuser at web.de
Sun Aug 31 04:11:26 EDT 2003
"mackstann" <mack at incise.org> schrieb im Newsbeitrag
news:mailman.1062286079.6474.python-list at python.org...
> I have the following function that compares two filenames based on their
> basename only:
>
> _basenameCmp = lambda self, *pair: cmp(*map(os.path.basename, pair))
Please note that all os.path functions are *awfully* slow! If ever possible
use a nonportable self made scheme.
It drove me nearly crazy when I detected that os.path split and join
operations took even longer than raw disk access in a directory scan
program....
(The other issue (decorated sorting) is more relevent of course.)
Kindly
Michael P
More information about the Python-list
mailing list