[PATCH 6/9] Add action classes for container member set management.

Vratislav Podzimek vpodzime at redhat.com
Mon Mar 24 07:51:53 UTC 2014


On Fri, 2014-03-21 at 10:14 -0500, David Lehman wrote:

> > > +
> > > +    def obsoletes(self, action):
> > > +        """
> > > +            obsoletes
> > > +                - remove same member from same container
> > > +                - add same member to same container w/ higher id
> > > +
> > > +            obsoleted by
> > > +                - destroy the container
> > > +                - destroy the device
> > > +                - remove same member from same container
> > > +        """
> > > +        retval = False
> > > +        if (action.isRemove and
> > > +            action.device == self.device and
> > > +            action.container == self.container):
> > > +            retval = True
> > > +        elif (action.isAdd and
> > > +              action.device == self.device and
> > > +              action.container == self.container and
> > > +              action.id > self.id):
> > > +            retval = True
> > > +
> > > +        return retval
> > This could again be a single return line or at least those retval
> > assignments (with the first one dropped) should be replaced with return
> > statements with 'return False' at the end.
> 
> I like having a single return statement in these types of places. It
> makes debugging much easier if the need arises. Is there a significant
> performance degradation in doing it this way?
I don't think it does any measurable peformance degradation so easier
debugging definitely wins.

-- 
Vratislav Podzimek

Anaconda Rider | Red Hat, Inc. | Brno - Czech Republic



More information about the anaconda-patches mailing list