This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author mwilliamson
Recipients docs@python, mwilliamson
Date 2014-08-10.14:18:24
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1407680304.87.0.195005785734.issue22180@psf.upfronthosting.co.za>
In-reply-to
Content
The Python docs for the operator module include an example using map and setitem to "Build a dictionary that maps the ordinals from 0 to 255 to their character equivalents.":

    d = {}
    keys = range(256)
    vals = map(chr, keys)
    map(operator.setitem, [d]*len(keys), keys, vals)   

Since map is lazy since Python 3, the dictionary d is never actually changed in this example. I'm not entirely sure what the idiomatic way to fix the example is since it strikes me as being fairly unidiomatic to begin with, but the simplest would be to call list on the result of map to force evaluation (patch attached).
History
Date User Action Args
2014-08-10 14:18:24mwilliamsonsetrecipients: + mwilliamson, docs@python
2014-08-10 14:18:24mwilliamsonsetmessageid: <1407680304.87.0.195005785734.issue22180@psf.upfronthosting.co.za>
2014-08-10 14:18:24mwilliamsonlinkissue22180 messages
2014-08-10 14:18:24mwilliamsoncreate