#20989: tuple() and dict() accept iterators --------------------------------------+------------------------------------ Reporter: jeroen.pulles@… | Owner: nobody Type: Cleanup/optimization | Status: closed Component: Uncategorized | Version: master Severity: Normal | Resolution: fixed Keywords: | Triage Stage: Accepted Has patch: 0 | Needs documentation: 0 Needs tests: 0 | Patch needs improvement: 0 Easy pickings: 0 | UI/UX: 0 --------------------------------------+------------------------------------
Comment (by charettes): I think the provided regex missed a few ones: {{{ (django)simon@simon-laptop:~/workspace/django$ grep "dict(\[" django/ -R django/db/backends/oracle/introspection.py: return dict([(d[0], i) for i, d in enumerate(self.get_table_description(cursor, table_name))]) django/db/backends/mysql/introspection.py: numeric_map = dict([(line[0], tuple([int(n) for n in line[1:]])) for line in cursor.fetchall()]) django/db/backends/mysql/introspection.py: return dict([(d[0], i) for i, d in enumerate(self.get_table_description(cursor, table_name))]) django/db/models/sql/query.py: return dict([ django/template/loader_tags.py: blocks = dict([(n.name, n) for n in django/template/loader_tags.py: values = dict([(name, var.resolve(context)) for name, var django/template/defaulttags.py: kwargs = dict([(smart_text(k, 'ascii'), v.resolve(context)) django/template/defaulttags.py: values = dict([(key, val.resolve(context)) for key, val in django/utils/html.py: kwargs_safe = dict([(k, conditional_escape(v)) for (k, v) in django/utils/termcolors.py:foreground = dict([(color_names[x], '3%s' % x) for x in range(8)]) django/utils/termcolors.py:background = dict([(color_names[x], '4%s' % x) for x in range(8)]) django/utils/cache.py: cc = dict([_to_tuple(el) for el in django/contrib/admin/filters.py: self.date_params = dict([(k, v) for k, v in params.items() django/contrib/messages/storage/cookie.py: return dict([(key, self.process_messages(value)) django/core/management/__init__.py: _commands.update(dict([(name, app_name) }}} {{{ (django)simon@simon-laptop:~/workspace/django$ grep "tuple(\[" django/ -R django/db/backends/oracle/base.py: return tuple([_rowfactory(r, self.cursor) django/db/backends/oracle/base.py: return tuple([_rowfactory(r, self.cursor) django/db/backends/mysql/introspection.py: numeric_map = dict([(line[0], tuple([int(n) for n in line[1:]])) for line in cursor.fetchall()]) django/db/models/query.py: yield tuple([data[f] for f in fields]) django/db/models/sql/compiler.py: row = tuple(row[:aggregate_start]) + tuple([ django/template/base.py: return self.msg % tuple([force_text(p, errors='replace') django/contrib/gis/gdal/geometries.py: return tuple([self[i] for i in xrange(len(self))]) django/contrib/gis/gdal/geometries.py: return tuple([self[i].tuple for i in xrange(self.geom_count)]) django/contrib/gis/gdal/geometries.py: return tuple([self[i].tuple for i in xrange(self.geom_count)]) django/contrib/gis/geos/coordseq.py: else: return tuple([self[i] for i in xrange(n)]) django/contrib/gis/geos/polygon.py: return tuple([self[i].tuple for i in xrange(len(self))]) }}} -- Ticket URL: <https://code.djangoproject.com/ticket/20989#comment:3> Django <https://code.djangoproject.com/> The Web framework for perfectionists with deadlines. -- You received this message because you are subscribed to the Google Groups "Django updates" group. To unsubscribe from this group and stop receiving emails from it, send an email to django-updates+unsubscr...@googlegroups.com. To post to this group, send email to django-updates@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/django-updates/085.dddd8cb9783c2daa2a3701d49690972f%40djangoproject.com. For more options, visit https://groups.google.com/groups/opt_out.