On Feb 15, 11:43 pm, Peter Otten <[EMAIL PROTECTED]> wrote: > Mattias Brändström wrote: > > Just one small tought/question. How likely am I to run into trouble > > because of this? I mean, by setting _cache to another value I'm > > mucking about in filecmp's implementation details. Is this generally > > considered OK when dealing with Python's standard library? > > I think it's a feature that Python lends itself to monkey-patching, but > still there are a few things to consider: > > - Every hack increases the likelihood that your app will break in the next > version of Python. > - You take some responsibility for the "patched" code. It's no longer the > tried and tested module as provided by the core developers. > - The module may be used elsewhere in the standard library or third-party > packages, and failures (or in the above example: performance degradation) > may ensue. > > For a script and a relatively obscure module like 'filecmp' monkey-patching > is probably OK, but for a larger app or a module like 'os' that is heavily > used throughout the standard lib I would play it safe and reimplement.
Thanks for the insight! Right now I need this for a unit test, so in this case I'm quite happy to use the NoCache solution you suggested. :.:: brasse -- http://mail.python.org/mailman/listinfo/python-list