[Python-checkins] r53824 - python/trunk/Doc/lib/libcollections.tex

Thomas Wouters thomas at python.org
Sat Feb 24 00:58:50 CET 2007


On 2/19/07, raymond.hettinger <python-checkins at python.org> wrote:

> +>>> def constant_factory(value):
> +...     return itertools.repeat(value).next


Ehm, no offense, Raymond (I know you love itertools, and so do I) but could
we maybe write this as:

>>> def constant_factory(value):
...     return lambda: value

(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 ;)

-- 
Thomas Wouters <thomas at python.org>

Hi! I'm a .signature virus! copy me into your .signature file to help me
spread!
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mail.python.org/pipermail/python-checkins/attachments/20070223/10ca70cf/attachment.html 


More information about the Python-checkins mailing list