Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.python > #98344
| Path | csiph.com!au2pb.net!feeder.erje.net!1.eu.feeder.erje.net!news-1.dfn.de!news.dfn.de!news.informatik.hu-berlin.de!fu-berlin.de!uni-berlin.de!not-for-mail |
|---|---|
| From | Ian Kelly <ian.g.kelly@gmail.com> |
| Newsgroups | comp.lang.python |
| Subject | Re: Question about math.pi is mutable |
| Date | Fri, 6 Nov 2015 03:38:10 -0700 |
| Lines | 15 |
| Message-ID | <mailman.80.1446806298.16136.python-list@python.org> (permalink) |
| References | <201511061033583772468@travelsky.com> |
| Mime-Version | 1.0 |
| Content-Type | text/plain; charset=UTF-8 |
| X-Trace | news.uni-berlin.de 1CeVP5PVH+kaJSHnmjK7gw+oCyOnInmHPa2iHcRmXqYA== |
| Return-Path | <ian.g.kelly@gmail.com> |
| X-Original-To | python-list@python.org |
| Delivered-To | python-list@mail.python.org |
| X-Spam-Status | OK 0.001 |
| X-Spam-Evidence | '*H*': 1.00; '*S*': 0.00; 'received:209.85.223': 0.03; 'value,': 0.03; 'modify': 0.04; 'newbie': 0.05; 'subject:Question': 0.05; '*name*': 0.09; 'python': 0.10; 'received:209.85.223.173': 0.16; 'received:io': 0.16; 'received:psf.io': 0.16; 'wrote:': 0.16; '>': 0.18; '(in': 0.18; 'math': 0.20; '2015': 0.20; 'assign': 0.22; 'am,': 0.23; 'header:In-Reply-To:1': 0.24; 'module': 0.25; 'question': 0.27; 'message-id:@mail.gmail.com': 0.27; 'skip:& 20': 0.35; 'received:google.com': 0.35; 'nov': 0.35; 'received:209.85': 0.36; 'to:addr:python-list': 0.36; 'subject:: ': 0.37; 'skip:& 10': 0.37; 'received:209': 0.38; 'why': 0.39; 'to:addr:python.org': 0.40; 'hello,': 0.40; 'python-list': 0.66; 'special': 0.73; 'china.': 0.79; 'to:name:python': 0.84 |
| DKIM-Signature | v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :content-type; bh=MZqi+3Mo7f7wrPjR68kBPF3YorSZyVWrC+CsvBRtXpc=; b=AYJUqxGYenGYvQIlPqD21EkphubYgBHpNQoHTwo9THv/btzBl+Y4bPBpn7t/QsleUz r+k4u3FiJ5syX9hDZ+iv1nO5xZL0sX2dHCj52abwz5QrEOAAfOSqSg9W3o3268kJIIdk 2UZDeDI+QgfhaiQiyFrHs6Zdvn6lwrfPQPM5tXrlg1uCxSHmAjH3EZSwkGjkof9qQ5W+ 7j4F/+2uS+7IIh7Tu9zDh5KJnuoCWilKo8O4Auhc4TXyIPJJ/NOtp5dqLy5SX2bWPOy0 828rHM9TMBe0JyFGn9qgjYT9TR42E/hmzXboAsJCTkbjtKRc/ZvA56KzhhJGCAnPbx4s IRZw== |
| X-Received | by 10.107.132.73 with SMTP id g70mr16237097iod.11.1446806290809; Fri, 06 Nov 2015 02:38:10 -0800 (PST) |
| In-Reply-To | <201511061033583772468@travelsky.com> |
| 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:98344 |
Show key headers only | View raw
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 comp.lang.python | Previous | Next | Find similar | Unroll thread
Re: Question about math.pi is mutable Ian Kelly <ian.g.kelly@gmail.com> - 2015-11-06 03:38 -0700
csiph-web