It does not need to be, but there is less overhead in reading a python variable than looking up an OS environment variable. So the code reads the environment variable only once and then we use that value in subsequent calls.