Opened 5 years ago
Closed 5 years ago
#31556 closed Cleanup/optimization (wontfix)
Remove useless (and inefficient) listcomp in the poll tutorial
Reported by: | Alexandre Poitevin | Owned by: | nobody |
---|---|---|---|
Component: | Documentation | Version: | 3.0 |
Severity: | Normal | Keywords: | |
Cc: | Triage Stage: | Accepted | |
Has patch: | no | Needs documentation: | no |
Needs tests: | no | Patch needs improvement: | no |
Easy pickings: | no | UI/UX: | no |
Description
output = ', '.join([q.question_text for q in latest_question_list])
This is not needed since a long time.
Change History (3)
comment:1 by , 5 years ago
comment:2 by , 5 years ago
Triage Stage: | Unreviewed → Accepted |
---|
The materialization of the list is not required as str.join
accepts an Iterator[str]
.
', '.join(q.question_text for q in latest_question_list)
comment:3 by , 5 years ago
Resolution: | → wontfix |
---|---|
Status: | new → closed |
This has come up before and was rejected… A list comprehension is preferable here as str.join()
converts to list internally anyway. It is better performance to provide a list up front.
Note:
See TracTickets
for help on using tickets.
Could you elaborate on its uselessness?