4

In python 2:

import math
print(math.pi)
3.14159265359
math.pi = 2
print(math.pi)
2
reload(math)
print(math.pi)
3.14159265359

Now in python 3:

import math
print(math.pi)
3.141592653589793
math.pi=2
print(math.pi)
2
from importlib import reload
reload(math)
print(math.pi)
2

I was expecting the reload to reset the value of pi in the math library. What do I wrong with the reload in python 3?

StarObs
  • 101
  • 3

0 Answers0