list vs array :
List can hold heterogeneous objects while array can't. For doing math on arrays, prefer numpy.
Source : http://stackoverflow.com/questions/176011/python-list-vs-array-when-to-use
list vs tuple :
tuples are fixed size and faster. Some tuples can be used as dictionary keys (specifically, tuples that contain immutable values like strings, numbers, and other tuples). Lists can never be used as dictionary keys, because lists are not immutable.
List can hold heterogeneous objects while array can't. For doing math on arrays, prefer numpy.
Source : http://stackoverflow.com/questions/176011/python-list-vs-array-when-to-use
list vs tuple :
tuples are fixed size and faster. Some tuples can be used as dictionary keys (specifically, tuples that contain immutable values like strings, numbers, and other tuples). Lists can never be used as dictionary keys, because lists are not immutable.
but unless you have a specific reason, always use list.
test_list = []
test_tuple = ()
test_dict = {}
No comments:
Post a Comment