So, After Tupling, When Do You Start to List? 

On the crucial differences between tuples and lists in Python

Listing is sort of like tupling, except lists are more loosey goosey. The stuff in a tuple is more solid than rock. It can’t be changed, not with a chisel, a jackhammer or bunker-busting bomb (however, see the postscript below for a loophole).

Lists, in contrast, are more flexible than your average yogi.  The data in a list can be changed, and the lists themselves can grow longer or shorter at will (or close to it).

You recognize a list because it comes in brackets rather than parentheses. So, here’s an example of a list:

thisList = [“Joe”, “Shiho”, “Jose”]

What’s cool about the list is that we can swap elements in or out. Let’s say Joe is just getting too gross for the poker-playing gang, with his jalapeno nacho breath and his cheesy fingers. We dump Joe from the list and substitute in Sarah, who makes an awesome bean dip. She’s on the list now, and Joe is out.

Here’s how you could do that in Python:

thisList = ["Joe", "Shiho", "Jose"]
print (thisList)

That will print your new list, the one with Joe gone and Sarah added::

 ["Shiho", "Jose", "Sarah"]

If you try to do the same thing with a tuple, it won’t work. Therefore, if you need some flexibility, go with the list. If you need tight, anal-compulsive security, go with the tuple.

PS: If you want some more information on lists, I recommend TutorialsPoint.

PPS: Some experts have noted that tuples are immutable but not necessarily unchanging. Yeah, I know that sounds like a contradiction. To learn about it, though, have a look at “Python tuples: immutable but potentially changing”.

Features image: Brazilian poker player Maria Eduarda "Maridu" Mayrinck during the World Series of Poker, 2009, Author: Juliano Maesano. From

You Tipple Wine, But What Do You Tuple? 

On the meaning and usage of tuples in Python

I dig the word “tuple”. It sounds like a word you should know but can’t quite place. It makes me think about tipple, as in tippling wine at the gallery opening. That, in turn, reminds me of the Monty Python sketch called “Stock Exchange Report,” in which a reporter broadcasts, “Ting tang tong rankled dithely, little tipples pooped and poppy things went pong!”

Great, right? That, in turn, reminds of Lewis Carroll: “Twas brillig, and the slithy toves did gyre and gimble in the wabe.”

But I digress. Back to tuples, a word that sounds like nonsense but is actually a mathematics term meaning an ordered grouping. One of the reasons it sounds familiar even to non-mathematicians is because it makes its way into the language in other ways, such as quintuple, sextuple, and octuple. So, when you think about some poor woman bearing quintuplets, think of them as a pretty darn long grouping of darling babies.

In Python world, a tuple is also like a grouping, consisting of a number of values separated by commas and contained inside parentheses.  Here’s an example of a tuple:

pokerFriends = ("Joe", "Shiho", "Jose")

Go ahead and type that into your IDLE shell and hit enter. Now, If you type the word “pokerFriends” into the Shell, it should spit out the tuple:

('Joe', 'Shiho', 'Jose')

So, now you have a tuple (which is a grouping, of course) that is called pokerFriends. The names, which are separated by commas, are the values. We could (and will) go deeper into these matters, but let’s quit for now. Just remember that you tipple wine and tuple values.

PS – If you’re the instant gratification type and want more info on tuples right now, you can try tutorialspoint or How to Think Like a Computer Scientist.

Featured image:  Dionne quintuplets, 1937, unknown author: