To declare multiple variables at the \"same time\" I would do:
a, b = True, False
But if I had to declare much more variables, it turns les
When people are suggesting "use a list or tuple or other data structure", what they're saying is that, when you have a lot of different values that you care about, naming them all separately as local variables may not be the best way to do things.
Instead, you may want to gather them together into a larger data structure that can be stored in a single local variable.
intuited showed how you might use a dictionary for this, and Chris Lutz showed how to use a tuple for temporary storage before unpacking into separate variables, but another option to consider is to use collections.namedtuple to bundle the values more permanently.
So you might do something like:
# Define the attributes of our named tuple
from collections import namedtuple
DataHolder = namedtuple("DataHolder", "a b c d e f g")
# Store our data
data = DataHolder(True, True, True, True, True, False, True)
# Retrieve our data
print(data)
print(data.a, data.f)
Real code would hopefully use more meaningful names than "DataHolder" and the letters of the alphabet, of course.