Gentoo Archives: gentoo-portage-dev

From: Brian Dolbec <dolsen@g.o>
To: gentoo-portage-dev@l.g.o
Subject: Re: [gentoo-portage-dev] [PATCH 2/2] Add profile-formats=build-id (bug 150031)
Date: Tue, 17 Feb 2015 19:58:40
Message-Id: 20150217115834.1afedca9.dolsen@gentoo.org
In Reply to: Re: [gentoo-portage-dev] [PATCH 2/2] Add profile-formats=build-id (bug 150031) by Zac Medico
1 On Tue, 17 Feb 2015 11:37:44 -0800
2 Zac Medico <zmedico@g.o> wrote:
3
4 > On 02/17/2015 10:58 AM, Brian Dolbec wrote:
5 > >
6 > > class Atom()
7 > >
8 > > if allow_repo is None:
9 > > allow_repo = True
10 > > + if allow_build_id is None:
11 > > + allow_build_id = True
12 > >
13 > >
14 > > these can be written as
15 > > allow_repo = allow_repo or True
16 > > allow_build_id = allow_build_id or True
17 >
18 > Actually, your version behaves differently than mine for the case
19 > where False has been passed in for these parameters. The parameters
20 > are designed are provide a "smart" default, as long as the caller has
21 > not passed in an explicit True or False value.
22
23
24 yeah, I never thought of the possibility of them being passed in False.
25
26 I just thought, hey, there is a shorter way of doing this. Usually
27 I've done that for variables expecting lists, class instances, etc...
28 --
29 Brian Dolbec <dolsen>