Path: csiph.com!fu-berlin.de!uni-berlin.de!not-for-mail From: Random832 Newsgroups: comp.lang.python Subject: Re: Question about math.pi is mutable Date: Mon, 09 Nov 2015 10:32:17 -0500 Lines: 24 Message-ID: References: <878u69zxww.fsf@elektro.pacujo.net> <563eba85$0$1611$c3e8da3$5496439d@news.astraweb.com> <87ziyowy83.fsf@elektro.pacujo.net> <8537wghwjb.fsf@benfinney.id.au> <85y4e8ggrj.fsf@benfinney.id.au> <85twowgfm6.fsf@benfinney.id.au> <564081e7$0$1592$c3e8da3$5496439d@news.astraweb.com> Mime-Version: 1.0 Content-Type: text/plain X-Trace: news.uni-berlin.de A9/1ZalYXlftVCrpsVAsngwGeW0IVM/IoKPy/DE1HwEg== Cancel-Lock: sha1:ZftUkKfab8qePMgsWlMKAXUgIvE= Return-Path: 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; 'else:': 0.03; 'compiler': 0.05; 'subject:Question': 0.05; 'attributes': 0.07; 'attribute.': 0.09; 'received:80.91': 0.09; 'received:80.91.229': 0.09; 'received:gmane.org': 0.09; 'received:list': 0.09; 'advance': 0.10; 'determining': 0.16; 'received:80.91.229.3': 0.16; 'received:io': 0.16; 'received:plane.gmane.org': 0.16; 'received:psf.io': 0.16; 'attribute': 0.18; 'decide': 0.23; 'sort': 0.25; 'module': 0.25; 'header:User-Agent:1': 0.26; "doesn't": 0.26; 'header:X-Complaints-To:1': 0.26; 'reset': 0.29; 'maybe': 0.33; 'changed': 0.33; "d'aprano": 0.33; 'received:comcast.net': 0.33; 'steven': 0.33; 'path': 0.35; 'depends': 0.36; 'to:addr:python-list': 0.36; 'subject:: ': 0.37; 'really': 0.37; 'two': 0.37; 'received:org': 0.37; 'things': 0.38; 'means': 0.39; 'to:addr:python.org': 0.40; 'your': 0.60; 'today': 0.65; 'change?': 0.84 X-Injected-Via-Gmane: http://gmane.org/ X-Gmane-NNTP-Posting-Host: c-68-39-146-59.hsd1.in.comcast.net User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.3 (gnu/linux) X-BeenThere: python-list@python.org X-Mailman-Version: 2.1.20+ Precedence: list List-Id: General discussion list for the Python programming language List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Xref: csiph.com comp.lang.python:98537 Steven D'Aprano writes: > The compiler doesn't need to decide in advance whether or not the module > attributes have been changed. It can decide that at runtime, just before > actually looking up the attribute. In pseudo-code: > > if attribute might have changed: > use the slow path just like today > else: > use the optimized fast path if attribute might have changed: check if attribute really did change if it didn't: reset means of determining if it might have changed goto the optimized fast path else: use the slow path and/or maybe make a new fast path else: use the optimized fast path And what if your optimization depends on _two_ things that might change? Do you create one really fast path and two sort of fast paths?