RFC: addCleanup should take *args and **kwargs?

Vincent Ladeuil v.ladeuil+lp at free.fr
Fri Apr 13 18:04:56 BST 2007


>>>>> "aaron" == Aaron Bentley <aaron.bentley at utoronto.ca> writes:

    aaron> Vincent Ladeuil wrote:
    >>>>>>> "robert" == Robert Collins <robertc at robertcollins.net> writes:
    >> 
    robert> On Fri, 2007-04-13 at 08:03 +0200, Vincent Ladeuil wrote:
    >> >> 
    >> >> +1, as long as we take care of checking the presence of the
    >> >> callable *and* its (*args, **kwargs) 
    >> 
    robert> What do you mean by this?
    >> 
    >> addCleanup checks that callable is not already in the cleanup
    >> list, if we use the same callable for different parameters, it
    >> should still be added, not rejected as a dupe.
    >> 
    >> Nit-picking, better safe than sorry, etc :)

    aaron> I don't think you can predict that

    aaron> 1. If a programmer mistakently adds a cleanup twice, that this fix will
    aaron> catch it
    aaron> 2. If a programmer adds a cleanup twice, it is a mistake.

self.addCleanup(restore_env_var, 'HOME')
self.addCleanup(restore_env_var, 'BZRDIR')

was what I had in mind

    Vincent



More information about the bazaar mailing list