logoalt Hacker News

semiinfinitelytoday at 8:22 PM2 repliesview on HN

your second function is the type of bad code you get from people trying to program python like its c


Replies

ktm5jtoday at 11:15 PM

Is there a pythonic way to satisfy the prompt? IE without making a new list?

wwfntoday at 11:03 PM

Absolutely! And the list.pop version is multiple orders of magnitude slower. But I took the prompt to be asking for in-place modification of the existing list. Comprehension does not do that.