Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.python > #98344 > unrolled thread
| Started by | Ian Kelly <ian.g.kelly@gmail.com> |
|---|---|
| First post | 2015-11-06 03:38 -0700 |
| Last post | 2015-11-06 03:38 -0700 |
| Articles | 1 — 1 participant |
Back to article view | Back to comp.lang.python
This discussion starts older than the indexed window; earlier articles aren't shown. The article labeled Started by
below is the oldest one visible, not the original post.
Re: Question about math.pi is mutable Ian Kelly <ian.g.kelly@gmail.com> - 2015-11-06 03:38 -0700
| From | Ian Kelly <ian.g.kelly@gmail.com> |
|---|---|
| Date | 2015-11-06 03:38 -0700 |
| Subject | Re: Question about math.pi is mutable |
| Message-ID | <mailman.80.1446806298.16136.python-list@python.org> |
On Nov 6, 2015 3:20 AM, "wangq@travelsky.com" <wangq@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.
Back to top | Article view | comp.lang.python
csiph-web