KnowledgeHub
Questions
Tags
Users
Search
Alex Rivera
|
Logout
Edit Question
Title
Body
Why do these two operations give different results? >>> c = [1, 2, 3] >>> c [1, 2, 3] >>> c += c >>> c [1, 2, 3, 1, 2, 3] >>> c = [1, 2, 3] >>> c.append(c) >>> c [1, 2, 3, [...]] >>> In the last case there's actually infinite recursion. c[-1] and c are the same. Why is it different with the + operation?
Tags (comma-separated)
Save Edits
Cancel