Oct-10-2021, 06:11 PM
(Oct-10-2021, 05:00 AM)ndc85430 Wrote: Is there a reason you can't use lazy sequences? It would really help if you showed code for what you're doing. It's difficult to discuss hypothetical things.
this is about doing lazy evaluation, for me. the code i have is big and complicated due to so much other stuff in it. i have no simple code that gets to the root of the matter, i have some potential directions to go. iterating the list in reverse, as was suggested is one of many. it could be done many ways. one of the ways could include
for x in range(len(the_list)-1,-1,-1):
(i like variable name x, think: index). if i delete the_list[x] inside the body of this for loop, it does not affect the iteration as the range iterator is now independent of the actual list and x only moves to non-mutated parts of the list. another approach i am considering is: instead of deleting the item in the list, store None in its place and change the code that uses the list to evaluate the list by treating None as absent data. and, sure, i could do that as its own iterator in many cases.i did not mention these ideas up front because i did not want to have any bias by this in the ideas others might offer. instead of discussing limited to my ideas, i want to see if there are other ideas and if any of the others might be treated as more significant.
Tradition is peer pressure from dead people
What do you call someone who speaks three languages? Trilingual. Two languages? Bilingual. One language? American.
What do you call someone who speaks three languages? Trilingual. Two languages? Bilingual. One language? American.