Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.python > #98506
| Path | csiph.com!news.mixmin.net!newsfeed.fsmpi.rwth-aachen.de!newsfeed.straub-nv.de!news-1.dfn.de!news.dfn.de!news.informatik.hu-berlin.de!fu-berlin.de!uni-berlin.de!not-for-mail |
|---|---|
| From | "wangq@travelsky.com" <wangq@travelsky.com> |
| Newsgroups | comp.lang.python |
| Subject | Re: Re: Question about math.pi is mutable |
| Date | Mon, 9 Nov 2015 08:52:42 +0800 |
| Lines | 20 |
| Message-ID | <mailman.166.1447060810.16136.python-list@python.org> (permalink) |
| References | <CAPTjJmr7brs6B=oD9m2bEk_Mm7wUTVKWU-gxqgAqDLV4diOdzw@mail.gmail.com> |
| Mime-Version | 1.0 |
| Content-Type | text/plain; charset="UTF-8" |
| Content-Transfer-Encoding | base64 |
| X-Trace | news.uni-berlin.de DhvkyVsIwdZDChetjjEmwAVRX1a0FEKO++7D/RD1ouhQ== |
| Return-Path | <wangq@travelsky.com> |
| X-Original-To | python-list@python.org |
| Delivered-To | python-list@mail.python.org |
| X-Spam-Status | OK 0.002 |
| X-Spam-Evidence | '*H*': 1.00; '*S*': 0.00; 'python,': 0.02; 'modify': 0.04; 'newbie': 0.05; 'subject:Question': 0.05; 'cc:addr:python- list': 0.09; 'mutable': 0.09; 'python': 0.10; ':-)': 0.12; 'advance!': 0.16; 'received:io': 0.16; 'received:psf.io': 0.16; 'sorts': 0.16; 'value:': 0.16; 'wrote:': 0.16; '>': 0.18; '(in': 0.18; '2015': 0.20; 'cc:2**0': 0.20; 'cc:addr:python.org': 0.20; 'chris': 0.26; 'fri,': 0.27; 'question': 0.27; 'decimal': 0.29; 'that.': 0.30; 'date:': 0.31; 'useful': 0.33; 'cc:': 0.35; 'nov': 0.35; 'replace': 0.35; 'subject:': 0.35; 'but': 0.36; 'there': 0.36; 'pm,': 0.36; 'subject:: ': 0.37; 'say': 0.37; 'thank': 0.38; 'hi,': 0.38; 'why': 0.39; 'from:': 0.39; 'hello,': 0.40; 'your': 0.60; 'times': 0.63; 'python-list': 0.66; 'virtually': 0.66; 'china.': 0.79; 'chrisa': 0.84 |
| X-Priority | 3 |
| X-Has-Attach | no |
| X-Mailer | Foxmail 7, 2, 6, 40[cn] |
| X-Mailman-Approved-At | Mon, 09 Nov 2015 04:20:09 -0500 |
| X-Content-Filtered-By | Mailman/MimeDel 2.1.20+ |
| X-BeenThere | python-list@python.org |
| X-Mailman-Version | 2.1.20+ |
| Precedence | list |
| List-Id | General discussion list for the Python programming language <python-list.python.org> |
| List-Unsubscribe | <https://mail.python.org/mailman/options/python-list>, <mailto:python-list-request@python.org?subject=unsubscribe> |
| List-Archive | <http://mail.python.org/pipermail/python-list/> |
| List-Post | <mailto:python-list@python.org> |
| List-Help | <mailto:python-list-request@python.org?subject=help> |
| List-Subscribe | <https://mail.python.org/mailman/listinfo/python-list>, <mailto:python-list-request@python.org?subject=subscribe> |
| Xref | csiph.com comp.lang.python:98506 |
Show key headers only | View raw
Hi, Chris Angelico ,
Thank you for your help ! :-)
From: Chris Angelico
Date: 2015-11-06 18:30
To: wangq@travelsky.com
CC: python-list
Subject: Re: Question about math.pi is mutable
On Fri, Nov 6, 2015 at 1:33 PM, 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")
>
> Thank you in advance!
>
> Best Wishes!
Simply because, in Python, virtually everything can be changed. You're
welcome to go in and say "math.pi = 3" if you like... and then you
accept the consequences of that.
There are times when you want to change these sorts of 'constants'.
For example, math.pi is a float; but if you're working with
decimal.Decimal everywhere, it might be useful to replace it with a
corresponding Decimal value:
math.pi = decimal.Decimal("3.14159265358979323")
And that's perfectly legal.
ChrisA
Back to comp.lang.python | Previous | Next | Find similar | Unroll thread
Re: Re: Question about math.pi is mutable "wangq@travelsky.com" <wangq@travelsky.com> - 2015-11-09 08:52 +0800
csiph-web