Recommended Answers
Jump to PostI'd use a tuple for heterogenous and/or fixed aggregates. Otherwise I'd use a list. Of course, there are always exceptions, but that's a generally universal guideline.
Jump to PostActually, tuples are mainly used by the Python language itself, for certain types of operations where lists would too slow, or where the immutability of tuples is helpful. For example, multiple return values are actually passed as a tuple, which can either be assigned as a single value or 'unpacked' …
Jump to PostA tuple uses much less memory than a list.
Jump to PostTuples, since they are immutable (can not be changed), are also useful for keys in a dictionary.
All 15 Replies
We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.