Gentoo Archives: gentoo-portage-dev

From: Brian Dolbec <dolsen@g.o>
To: gentoo-portage-dev@l.g.o
Subject: Re: [gentoo-portage-dev] [PATCH v2] Add --output-style option to repoman
Date: Thu, 13 Feb 2014 21:06:47
Message-Id: 20140213130220.355b8796@big_daddy.dol-sen.ca
In Reply to: Re: [gentoo-portage-dev] [PATCH v2] Add --output-style option to repoman by Alec Warner
1 On Thu, 13 Feb 2014 10:03:50 -0800
2 Alec Warner <antarus@g.o> wrote:
3
4 > On Thu, Feb 13, 2014 at 7:42 AM, Brian Dolbec <dolsen@g.o>
5 > wrote:
6 >
7 > > well actually, for simple additions like that, string1 + string2,
8 > > it is actually faster.
9 > > But for multiple additions, %s is much better, faster. Also if the
10 > > string is translated, then use %s regardless. That way the %s can
11 > > be moved around for the translation.
12 > >
13 >
14 > In general we prefer % for readability purposes, not because it is
15 > faster.
16 >
17 > foo = "Bar" + foo + " " + baz + "," + goat
18 >
19 > foo = "Bar %s %s, %s" % (foo, baz, goat)
20 >
21 > I think this case could go either way, because even with %,
22 > "NumberOf%s" is not much of an improvement.
23 > The code is littered with the former though, and it makes it really
24 > annoying to read ;)
25 >
26 > -A
27
28 Do I have to sick Brian Harring on you ;)
29
30 I said for simple string addition... string1 + string2 is faster and
31 equally readable
32
33 Your example goes into the "string %s %s, %s" example where the string
34 substitution is actually faster. Plus it is a lot more readable.
35
36
37 --
38 Brian Dolbec <dolsen>