Path: csiph.com!usenet.pasdenom.info!news.albasani.net!rt.uk.eu.org!newsfeed.xs4all.nl!newsfeed3.news.xs4all.nl!xs4all!post.news.xs4all.nl!not-for-mail Return-Path: X-Original-To: python-list@python.org Delivered-To: python-list@mail.python.org X-Spam-Status: OK 0.031 X-Spam-Evidence: '*H*': 0.94; '*S*': 0.00; 'subject:Python': 0.06; 'modify': 0.07; 'modifying': 0.07; 'portions': 0.09; 'cc:addr :python-list': 0.11; 'python': 0.11; 'caching': 0.16; 'code?': 0.16; 'compiler.': 0.16; 'effect.': 0.16; 'from:addr:rosuav': 0.16; 'from:name:chris angelico': 0.16; 'it),': 0.16; 'nightmare': 0.16; 'subject:Was': 0.16; 'modification': 0.16; 'wrote:': 0.18; '(not': 0.18; 'code.': 0.18; 'cc:addr:python.org': 0.22; 'load': 0.23; 'replace': 0.24; 'cc:2**0': 0.24; "i've": 0.25; 'gets': 0.27; 'header:In-Reply-To:1': 0.27; 'function': 0.29; 'message- id:@mail.gmail.com': 0.30; 'code': 0.31; '13,': 0.31; "d'aprano": 0.31; 'steven': 0.31; 'run': 0.32; 'subject: (': 0.35; 'something': 0.35; 'but': 0.35; 'received:google.com': 0.35; 'add': 0.35; 'executing': 0.36; 'done': 0.36; 'being': 0.38; 'pm,': 0.38; 'little': 0.38; 'changed': 0.39; 'viruses': 0.61; 'times': 0.62; 'subject:The': 0.64; 'more': 0.64; 'virus': 0.65; 'useful.': 0.68; 'subject:have': 0.80; 'counts': 0.83; 'bald': 0.84; 'decorate': 0.84; 'hmm...': 0.84; 'horrible': 0.84; 'itself?': 0.84; 'pike': 0.84; 'notorious': 0.91; 'to:none': 0.92 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:cc :content-type; bh=wsm4+uU6+/9iLk2Mowwn4TTT40RtHfeT9B5Th9cIDYY=; b=Qq60n3OSjIMKr/JFtfEzVo+NvAP/hma/JDijMlJJnZ7TMt5ysKlPJK/XCEBWWkQxF5 dqQXS2GO1LL//BakYNOmV2LPvab9BiHNMlQI0c0GotUR57FEZGUji8K5uuznKt0jMGm/ RyjlLbaY6VciRYRc9nWC+JBFrzslI3Yy1tXcRDKs5sInjGoSx+8b8ZcN5SnMKT3rtXTF pVy6UbeD0VeNKH6oLWZCm94MTWzREKUQrfrbjngW6HkWbabXpTXw8McAVSSR955rWAoZ BE+gCN/AP7HDe/xMVtEG6xSnljwg6xCQdr46LrD8/g65Eo8gIx5VDCVPVhg71PaKjbQn 4G+Q== MIME-Version: 1.0 X-Received: by 10.221.20.199 with SMTP id qp7mr27198056vcb.24.1399960610319; Mon, 12 May 2014 22:56:50 -0700 (PDT) In-Reply-To: <5371b23a$0$11109$c3e8da3@news.astraweb.com> References: <87tx91warf.fsf@elektro.pacujo.net> <85eh05cdjx.fsf@benfinney.id.au> <87ha50hagu.fsf@elektro.pacujo.net> <536b8411$0$29965$c3e8da3$5496439d@news.astraweb.com> <536b9308$0$29965$c3e8da3$5496439d@news.astraweb.com> <536bab23$0$29965$c3e8da3$5496439d@news.astraweb.com> <87mweotfe5.fsf@dpt-info.u-strasbg.fr> <87iopbtmh1.fsf@dpt-info.u-strasbg.fr> <5371b23a$0$11109$c3e8da3@news.astraweb.com> Date: Tue, 13 May 2014 15:56:50 +1000 Subject: Re: Fortran (Was: The "does Python have variables?" debate) From: Chris Angelico Cc: "python-list@python.org" Content-Type: text/plain; charset=UTF-8 X-BeenThere: python-list@python.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: General discussion list for the Python programming language List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Newsgroups: comp.lang.python Message-ID: Lines: 20 NNTP-Posting-Host: 2001:888:2000:d::a6 X-Trace: 1399960620 news.xs4all.nl 2943 [2001:888:2000:d::a6]:38172 X-Complaints-To: abuse@xs4all.nl Xref: csiph.com comp.lang.python:71433 On Tue, May 13, 2014 at 3:48 PM, Steven D'Aprano wrote: > Self-modifying code is a nightmare inside the head of a Lovecraftian > horror. There's a reason why almost the only people still using self- > modifying code are virus writers, and the viruses they create are > notorious for being buggy. Hmm... what counts as self-modifying, though? When you decorate a function to modify its behaviour (eg add caching around it), all the modification happens at compile time, but it's still executing something other than what you see as the bald code. What about a microkernel that can load altered code from the disk, compile it into memory, and replace portions of itself? I've done that a number of times (not in Python as it has little support for it, but in Pike it's easy); is that self-modifying code? Or a JIT compiler. As you run something, it gets changed in form to be more streamlined. None of these is as horrible as the loop that fiddles with its own code on the fly, but any of them, if buggy, will have the same effect. And all are useful. ChrisA