Comment by TZubiri
2 days ago
#Takes around 1 second s="a"*3000000000
#instant, does not consume twice as much memory. s+="a"
I don't know the internals, but certainly there's not a new string being created. Maybe if it exceeds capacity? Who cares at that point, it's python strings, not Matmuls in C.
No comments yet
Contribute on Hacker News ↗