import stack if not stack.empty(): x = stack.pop() # qualify by module name stack.push(1.23)