Re: [jenkins-ci PATCH v2 03/12] lcitool: Add tool configuration handling

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Tue, 2018-07-17 at 11:40 +0200, Katerina Koukiou wrote:
> On Thu, Jul 12, 2018 at 05:19:20PM +0200, Andrea Bolognani wrote:
> > +        try:
> > +            with open(flavor_file, "r") as f:
> > +                flavor = f.readline().strip()
> > +        except:
> 
> And it's generally discouraged to use a bare except because it catches
> BaseException. Be at least as specific as Exception, and here
> specifically, perhaps catch IOError.

Okay, I've done some reading about Exception vs BaseException and
I think I see now why you would want to catch the former but not
the latter.

Catching IOError specifically doesn't seem too useful here,
though, because it would still result in an Error being raised
and the program ultimately exiting. Or am I missing something?

> > +        if flavor != "test" and flavor != "jenkins":
> 
> More pythonic would be "flavor not in ('test', 'jenkins')"

Okay.

-- 
Andrea Bolognani / Red Hat / Virtualization

--
libvir-list mailing list
libvir-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/libvir-list



[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]

  Powered by Linux