Python Forum
convert list compression to for loop
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
convert list compression to for loop
#6
As a note about miltmobley's comments:
I strongly recommend using the append() method instead of +=. The latter requires creating many intermediate lists, which is unnecessary.
List comprehensions can be faster, but "efficient" often has a technical meaning (complexity analysis, big-O), so just be aware of potential pushback from that wording.
Reply


Messages In This Thread
RE: convert list compression to for loop - by micseydel - Oct-09-2017, 10:42 PM

Possibly Related Threads…
Thread Author Replies Views Last Post
  convert set to a list type in python firaki12345 2 1,791 Feb-05-2021, 03:45 PM
Last Post: buran
  how to edit data frames and convert to a list(pandas, read_html()) ? donvirte 3 4,406 Feb-02-2018, 03:23 PM
Last Post: snippsat

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020