[New-bugs-announce] [issue27396] Change default filecmp.cmp shallow option

Gabriel Hackebeil report at bugs.python.org
Sun Jun 26 21:57:36 EDT 2016


New submission from Gabriel Hackebeil:

I would like to propose changing the default setting for the shallow compare option in filecmp.cmp to False (or providing access an exact comparison function that does not use various performance optimizations).

I think many users will turn to this module as a replacement for the “diff” command on Unix systems, and it is far too easy of a trap to fall into thinking a full comparison takes place when calling filecmp.cmp.

I agree that the shallow compare option is a useful feature, but I think it should be something to opt into as it is more of a performance optimization (the same applies to the caching behavior, but that is for another time).

I understand that the documentation explains the default behavior, but the reality is that many users probably do not understand the consequences of this setting (or simply did not pay close enough attention to the documentation), making it easy for people to use this module wrong and write code that does not work as advertised. I admit to falling into this trap myself.

----------
components: Library (Lib)
messages: 269336
nosy: ghackebeil
priority: normal
severity: normal
status: open
title: Change default filecmp.cmp shallow option
type: behavior

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue27396>
_______________________________________


More information about the New-bugs-announce mailing list