Re: Patch to clear RuleSet
"Phillip J. Eby" <pje-Wh6+Hckhi6HFNGf7iClzIwC/[email protected]>
| Newsgroups | gmane.comp.python.peak |
|---|---|
| Message-ID | <[email protected]> |
At 01:58 PM 7/9/2008 +0200, Alberto Valverde wrote: >Hi Phillip, > >It has been requested in turbogears-trunk [1] for a mechanism to clear >all rules in a generic function like the old RuleDispatch's >GenericFunction.clear() method. I've created a patch against the latest >trunk that implements this. Maybe you want to consider adding it. Actually, I'd prefer to add a RuleSet.clear() method, so you could use rules_for(func).clear() in that case, rather than having a standalone function. It also appears to me that RuleSet.__iter__ is broken, in that it really should hold the lock for the entire iteration, as it's not threadsafe otherwise. :( So, certainly the remove() operation should be atomic too.