What does this python codes mean?
<p>What does this python codes mean? New to python. THX!</p>

<pre><code>  benchmark_sets_list = [
  '%s:  %s' %
  (set_name, benchmark_sets.BENCHMARK_SETS[set_name]['message'])
  for set_name in benchmark_sets.BENCHMARK_SETS]
</code></pre>

<p>This part...</p>

<pre><code>for set_name in benchmark_sets.BENCHMARK_SETS
</code></pre>

<p>...will grab the set names from <code>benchmark_sets.BENCHMARK_SETS</code> and it will keep them one by one into a <code>set_name</code> variable.</p>

<p>After that, it will be able to know the values from this line...</p>

<pre><code>(set_name, benchmark_sets.BENCHMARK_SETS[set_name]['message'])
</code></pre>

<p>...because <code>set_name</code> will have a value. That part will return two things, <code>set_name</code> and <code>benchmark_sets.BENCHMARK_SETS[set_name]['message']</code>. Probably those two things will be both strings.</p>

<p>Then, those <code>%s</code> you see in this line...</p>

<pre><code>'%s:  %s' %
</code></pre>

<p>...will be replaced by the value of <code>set_name</code> and <code>benchmark_sets.BENCHMARK_SETS[set_name]['message']</code> respectively. That will generate an string like this one: "foo: bar", being "foo" the value of <code>set_name</code> and "bar" the value of <code>benchmark_sets.BENCHMARK_SETS[set_name]['message']</code>.</p>

<p>In order for you to understand what happened there, this is a simple example:</p>

<p><code>"%s %s %s" % (first_elem, second_elem, third_elem)</code></p>

<p>That code will replace the first <code>%s</code> with the value of <code>first_elem</code> The second <code>%s</code> with the value of <code>second_elem</code>, and the third <code>%s</code> with the value of <code>third_elem</code>.</p>

<p>And finally that string will be added to the list which is being constructed. So, at the end you will have an list more or less like this one:</p>

<pre><code>["foo: bar", "wop: wap", "bing: bang"]
</code></pre>

python