<br><div><span class="gmail_quote">On 2/19/07, <b class="gmail_sendername">raymond.hettinger</b> &lt;<a href="mailto:python-checkins@python.org">python-checkins@python.org</a>&gt; wrote:</span><br><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
+&gt;&gt;&gt; def constant_factory(value):<br>+...&nbsp;&nbsp;&nbsp;&nbsp; return itertools.repeat(value).next</blockquote><div><br>Ehm, no offense, Raymond (I know you love itertools, and so do I) but could we maybe write this as:<br><br>&gt;&gt;&gt; def constant_factory(value):
<br>...&nbsp;&nbsp;&nbsp;&nbsp; return lambda: value<br></div><br>(or the two-line inner-function way to write the same thing.) It is, after all, documentation of defaultdict, not of weird-ways-to-use-itertools ;)<br></div><br>-- <br>Thomas Wouters &lt;
<a href="mailto:thomas@python.org">thomas@python.org</a>&gt;<br><br>Hi! I&#39;m a .signature virus! copy me into your .signature file to help me spread!