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

Antoine Pitrou report at bugs.python.org
Sun Aug 10 19:10:03 CEST 2014

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", modern Python code should use a dict comprehension and avoid operator.setitem() entirely.

nosy: +pitrou, rhettinger

Python tracker <report at bugs.python.org>

More information about the docs mailing list