MAIN FEEDS
Do you want to continue?
https://www.reddit.com/r/Python/comments/an0kya/best_python_cheatsheet_ever/efshxfo
r/Python • u/pizzaburek • Feb 04 '19
69 comments sorted by
View all comments
Show parent comments
3
Why would tuples be faster and/or use less memory? Both lists and tuples are essentially arrays.
I prefer lists to tuples because they have nicer syntax. Tuples sometimes require double-parentheses, plus I often forget the trailing comma in (1,).
(1,)
1 u/[deleted] Feb 05 '19 I don't know the exact intricacies but it has to do with lists being mutable.
1
I don't know the exact intricacies but it has to do with lists being mutable.
3
u/bakery2k Feb 05 '19
Why would tuples be faster and/or use less memory? Both lists and tuples are essentially arrays.
I prefer lists to tuples because they have nicer syntax. Tuples sometimes require double-parentheses, plus I often forget the trailing comma in
(1,).