Q:

Python Variables Referecing - unexpected behavior with zip

I really thought I understood Python variable referencing, so I'm confused why this code isn't making the variable "a" be "1":
>>> a,b,c = None, None, None
>>> for var, val in zip((a,b,c),[1]):
...     var = val
... 
>>> print a
None
>>> print var
1

Can anyone explain what Python is doing here?  Why don't "var" and "a" point to the same place?
Bonus question: What's an elegant way to assign three variables from a list that can have 1-3 items and leave the variables set to None if the list falls short?

A:

Can anyone explain what Python is doing here?

It's assigning the value of the variable val to the variable var. It is not changing a. Try the following to see what is happening:
>>> a, b, c = None, None, None
>>> print(zip((a,b,c), [1,2,3]))
[(None, 1), (None, 2), (None, 3)]

zip never sees the variables a, b and c, just the values they are bound to.
Read up on Python's use of variables (names, really) in Code Like a Pythonista.

What's an elegant way to assign three variables from a list that can have 1-3 items and leave the variables set to None if the list falls short?

Don't construct variables dynamically. Use a list instead.
vars = (lst + [None] * 3)[:3]

Then use vars[0] etc. Or
x, y, z = (lst + [None] * 3)[:3]

