Making a new variables list - python

Hey, I have a python question. Seeing as I’m building up a big line list of variables, I desided to shrink the line use down by making a list = []. But for some reason it gives me errors if the variable hasn’t been used yet. Whys that? I get the error, but I don’t get the error by thought…

toknow, self.DidMove, self.TempFlashLight,\n', "AttributeError: Game instance has no attri
bute 'PlayerJump'\n"]
      ItemsThatAreFalse = [self.PlayerJump, self.TempSpeedChange, self.CanShoot, self.Crouch, self.UserHasMouse, self.CanWork, self.FireKeyStillDown, self.GameMenuOpenClose, self.switching, self.needtoknow, self.DidMove, self.TempFlashLight, 
                           self.knife, self.Pistol, self.ShotGun, self.Mrifle, self.PulseRifle, self.RocketLauncher, self.MiniGun, self.Sniper, self.BFG]
      for x in ItemsThatAreFalse:
        x = False

Or is there a better way to shink it?

ItemsThatAreFalse = ["PlayerJump", "TempSpeedChange", "CanShoot"]
for x in ItemsThatAreFalse:
  setattr(self, x, False)

or

self.PlayerJump = self.TempSpeedChange = self.CanShoot = False

or dont shrink it and comment what the variables are used for.

Thanks Hypnos. That helps a lot. Redus about 100 lines of code lol.

For clarity, it’s a lot better to just write out your variable assignments line by line. Having more lines doesn’t really hurt in any way, and it only makes it clearer to see what the code does.