Re: Patch to clear RuleSet
"Phillip J. Eby" <pje-Wh6+Hckhi6HFNGf7iClzIwC/[email protected]>
| Newsgroups | gmane.comp.python.peak |
|---|---|
| Message-ID | <[email protected]> |
At 11:05 AM 7/15/2008 -0400, Phillip J. Eby wrote: >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. Okay, both RuleSet.clear() and a fixed RuleSet.__iter__ are in SVN and a snapshot build now, along with a temporary fix for the IsSubclass issue. It seems to me that there is more to the issubclass issue than meets the eye, in that there are potentially other test combinations that might really need to be ordered similarly. I'll write up another post with some thoughts on that as soon as it's practical.