<div class="gmail_quote">spir wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;"><div id=":2d7" class="ii gt">A "parameterisable" generator factory: [...]</div>
</blockquote><div><br></div><div>Good lord, no! Nooo!</div><div><br></div></div><blockquote class="webkit-indent-blockquote" style="margin: 0 0 0 40px; border: none; padding: 0px;"><div class="gmail_quote"><div>"power" is one thing with one semantic meaning</div>
</div><div class="gmail_quote"><div>"range" is another thing with another semantic meaning</div></div></blockquote><div class="gmail_quote"><div><br></div><div>There is absolutely no excuse for mixing the two implementation into a "power-range" monstrosity. Implement the two separately and make some custom function composition like:</div>
<div><br></div><div><div>def pow(x, n):</div><div> return x**n</div><div><br></div><div>def pow_o_range(n, a, b):</div><div> return [(x, pow(x, n)) for x in range(a,b)]</div><div><br></div><div>for i, x in pow_o_range(3, 1, 10):</div>
<div> print "%s:%s" % (i,x),</div><div><br></div><div># prints "<span class="Apple-style-span" style="font-family: arial, sans-serif; font-size: 13px; border-collapse: collapse; ">1:1 2:8 3:27 4:64 5:125 6:216 7:343 8:512 9:729"</span></div>
</div></div>