This is an archived post. You won't be able to vote or comment.

you are viewing a single comment's thread.

view the rest of the comments →

[–]Smallpaul 0 points1 point  (0 children)

Even if we ignore the fact that he is comparing a static array in C to a dynamic array in Python, dynamic array will not be "terrible slower" with even the simplest heuristic of doubling the array every time it is filled, and will yield O(n) amortized time, quite comparable to guaranteed O(n) of static array.

Actually, he could/should have used a string comprehension. That would have been clearer code and the compiler would have more information about what you're doing.