On Fri, Oct 01, 2010 at 06:52:20PM +0200, Radek Vykydal wrote: > On 10/01/2010 06:35 PM, Brian C. Lane wrote: > > > >>+ @property > >>+ def gateway(self): > >>+ """GATEWAY - last device in list wins""" > >>+ gw = "" > >>+ for dev in self.netdevices.values(): > >>+ gw = dev.get('GATEWAY') > >>+ return gw > >Is this a list? why not use self.netdevices.values()[-1]? After checking > >to make sure len is> 0 of course. > > > > Aah thanks, stupid me, it should be: > > for dev in self.netdevices.values(): > if dev.get('GATEWAY'): > gw = dev.get('GATEWAY') > Oh, I see, last entry that has a GATEWAY, and not all entries have it. It could be simplified with: gw = dev.get('GATEWAY', gw) ;) -- Brian C. Lane / Anaconda Team Port Orchard, WA (PST8PDT)
Attachment:
pgptjUW6tTcK0.pgp
Description: PGP signature
_______________________________________________ Anaconda-devel-list mailing list Anaconda-devel-list@xxxxxxxxxx https://www.redhat.com/mailman/listinfo/anaconda-devel-list