[issue22180] operator.setitem example no longer works in Python 3 due to lazy map

2014-08-10 Thread Raymond Hettinger
Changes by Raymond Hettinger : -- resolution: -> fixed stage: -> resolved status: open -> closed ___ Python tracker ___ ___ Python-b

[issue22180] operator.setitem example no longer works in Python 3 due to lazy map

2014-08-10 Thread Roundup Robot
Roundup Robot added the comment: New changeset 9c250f34bfa3 by Raymond Hettinger in branch '3.4': Issue #22180: Remove weak example http://hg.python.org/cpython/rev/9c250f34bfa3 -- nosy: +python-dev ___ Python tracker

[issue22180] operator.setitem example no longer works in Python 3 due to lazy map

2014-08-10 Thread Antoine Pitrou
Antoine Pitrou added the comment: Le 10/08/2014 13:20, Raymond Hettinger a écrit : > > Raymond Hettinger added the comment: > >> The whole example is bad and should be removed >> or replace with something else: > > I'm not sure there are ANY examples of operator.setitem that > couldn't be done a

[issue22180] operator.setitem example no longer works in Python 3 due to lazy map

2014-08-10 Thread Raymond Hettinger
Raymond Hettinger added the comment: > The whole example is bad and should be removed > or replace with something else: I'm not sure there are ANY examples of operator.setitem that couldn't be done a better way without it. How about we remove it and leave the examples for things that people

[issue22180] operator.setitem example no longer works in Python 3 due to lazy map

2014-08-10 Thread Antoine Pitrou
Antoine Pitrou added the comment: The whole example is bad and should be removed or replace with something else: 1. Using map() is an anti-pattern here, since the function results are not used. 2. To "build a dictionary that maps the ordinals from 0 to 255 to their character equivalents", mode

[issue22180] operator.setitem example no longer works in Python 3 due to lazy map

2014-08-10 Thread R. David Murray
R. David Murray added the comment: Heh. There was a discussion in issue 22106 about valid examples for using 'pass'. This case is analogous to the one I came up with. for x in map(...): pass that avoids building a list. Not that any of it is idiomatic, as you say. -- nosy: +

[issue22180] operator.setitem example no longer works in Python 3 due to lazy map

2014-08-10 Thread Michael Williamson
New submission from Michael Williamson: 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.set