[PEAK] naming.lookup() vs config.lookupComponent()
    Doug Quale 
    quale1 at charter.net
       
    Tue Jun 22 10:26:33 EDT 2004
    
    
  
In the shower this morning I realized that I used the wrong
comparison (== instead of is).
   if fast is not None and slow == fast:
should be
   if fast is not None and fast is slow:
> def iterParents(component):
> 
>     """Iterate over all parents of 'component'"""
> 
>     # Use tortoise and hare algorithm to detect circular parent hierarchies.
>     slow = fast = component
> 
>     while slow is not None:
> 
>         yield slow
> 
>         slow = getParentComponent(slow)
> 
>         fast = getParentComponent(getParentComponent(fast))
>         if fast is not None and slow == fast:
>             raise exception.CyclicComponentTree('circular component parent hierarchy')
> _______________________________________________
> PEAK mailing list
> PEAK at eby-sarna.com
> http://www.eby-sarna.com/mailman/listinfo/peak
    
    
More information about the PEAK
mailing list