954,174 Members — Technology Publication meets Social Media
Username:
Password:
Lost login information?
Have something to say? Contribute New Article Reply to this Article

tuple or list?

from my understanding, a list can do everything a tuple can do plus more. The big advantage of using a list is you can change elements, lists are mutable. Are their situations where a tuple is preferable to a list?

shanenin
Posting Whiz in Training
217 posts since May 2005
Reputation Points: 10
Solved Threads: 17
 

Tuples are handy for transferring multiple data, for instance to and from a function. They are easy to construct and transfer and assign their data easily. Check the multiReturn() example in the "Starting Python" sticky to see what I mean.

vegaseat
DaniWeb's Hypocrite
Moderator
5,976 posts since Oct 2004
Reputation Points: 1,345
Solved Threads: 1,416
 

This question has already been solved

Post: Markdown Syntax: Formatting Help
You