On Nov 6, 2015 3:20 AM, "wa...@travelsky.com" <wa...@travelsky.com> wrote: > > Hello, python-list guys: > > I am a newbie of python from Beijing. China. > I have a question about "math.pi". > As you can see in the attachment, why i can modify "math.pi"? > (in "mathmodule.c" "pi" is a "static const double")
Like all floats, math.pi is immutable. However, the *name* pi in the math module is not special and can be rebound to a new value, like (almost) any other name. So yes, you can assign 3 to math.pi. You can also assign 3 to math.sqrt, or os.urandom, or float. -- https://mail.python.org/mailman/listinfo/python-list