Clashing cmp
Andrew Dalke
dalke at bioreason.com
Tue Sep 21 17:58:49 EDT 1999
Fred L. Drake, Jr. <fdrake at acm.org>:
> This tells me nobody has cared about the module until now. If
> this is indeed the case, should it even remain "standard"?
Actually, the first time I needed it was a couple of days ago:
http://www.biopython.org/pipermail/biopython/1999-September/000053.html
I just figured it had been around enough that any discussion on
the merits of names had passed, so I wasn't going to bring it up.
Here was my workaround:
# "cmp" module compares two files using the cmp() function.
# Work around an ugliness in Python since cmp() is also a builtin!
old_cmp = cmp
from cmp import cmp
file_compare = cmp
cmp = old_cmp
It was nice to have the functionality handy. I can say, though,
that I started by looking for it in shutil, since I figured it
was natural to have file "compare" next to "copy" and "rmtree".
So I would have no problem moving the cmp functionality (the
functions "cmp" and "do_cmp") into shutil and renaming "cmp"
to "file_compare" and "do_cmp" to "do_file_compare".
Andrew
dalke at bioreason.com
More information about the Python-list
mailing list