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@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list

Reply via email to