summaryrefslogtreecommitdiff
path: root/docs
diff options
context:
space:
mode:
authorTim Graham <timograham@gmail.com>2015-09-24 13:17:39 -0400
committerTim Graham <timograham@gmail.com>2015-09-24 13:18:45 -0400
commitbb90e8fa2b1222c6408f4cfacac2c66955f75622 (patch)
treedd3a3899b8809e8f74343b30cbcebb8867a60949 /docs
parent66f50e97d6628afa8387266318af93851e240205 (diff)
[1.8.x] Fixed #25455 -- Optimized dictfetchall() example.
Thanks aklim007 for the suggestion. Backport of 361f60479d1890e8144fc254d7389a67b35725e9 from master
Diffstat (limited to 'docs')
-rw-r--r--docs/topics/db/sql.txt4
1 files changed, 2 insertions, 2 deletions
diff --git a/docs/topics/db/sql.txt b/docs/topics/db/sql.txt
index dc40d1f3e6..debebb0fa2 100644
--- a/docs/topics/db/sql.txt
+++ b/docs/topics/db/sql.txt
@@ -282,9 +282,9 @@ using something like this::
def dictfetchall(cursor):
"Return all rows from a cursor as a dict"
- desc = cursor.description
+ columns = [col[0] for col in cursor.description]
return [
- dict(zip([col[0] for col in desc], row))
+ dict(zip(columns, row))
for row in cursor.fetchall()
]