Thanks, and please excuse the unnecessary post. It turns out that the variable was being surreptitiously modified by another function buried in multiple layers of recursion, and that I was confused after too many hours of coding. Not a python issue at all, but a program design issue.