Path: csiph.com!v102.xanadu-bbs.net!xanadu-bbs.net!feeder.erje.net!eu.feeder.erje.net!newsreader4.netcologne.de!news.netcologne.de!xlned.com!feeder7.xlned.com!newsfeed.xs4all.nl!newsfeed1.news.xs4all.nl!xs4all!newsgate.cistron.nl!newsgate.news.xs4all.nl!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.002 X-Spam-Evidence: '*H*': 1.00; '*S*': 0.00; '(so': 0.07; 'indices': 0.07; 'rename': 0.07; 'strict': 0.07; 'function,': 0.09; 'mess': 0.09; 'rewrite': 0.09; 'statements': 0.09; 'will,': 0.09; 'python': 0.11; '"can\'t': 0.16; '(code': 0.16; '(note,': 0.16; 'confuse': 0.16; 'fiddle': 0.16; 'from:addr:rosuav': 0.16; 'from:name:chris angelico': 0.16; 'itself),': 0.16; 'itself,': 0.16; 'losing': 0.16; 'subject:Several': 0.16; 'sys.modules': 0.16; 'tweak': 0.16; 'language': 0.16; 'wrote:': 0.18; 'do.': 0.18; 'wed,': 0.18; 'bit': 0.19; 'module': 0.19; 'basically': 0.19; 'memory': 0.22; 'rules': 0.22; 'instance,': 0.24; 'lets': 0.24; 'pointer': 0.24; 'resumes': 0.24; 'fairly': 0.24; '(or': 0.24; 'sort': 0.25; 'somewhere': 0.26; 'gets': 0.27; 'header:In- Reply-To:1': 0.27; 'function': 0.29; 'am,': 0.29; 'instruction': 0.29; 'patch': 0.29; 'quickly': 0.29; 'message- id:@mail.gmail.com': 0.30; "i'm": 0.30; 'code': 0.31; 'posting': 0.31; 'file': 0.32; 'languages': 0.32; 'quite': 0.32; 'running': 0.33; 'could': 0.34; 'basic': 0.35; 'something': 0.35; 'but': 0.35; 'received:google.com': 0.35; 'add': 0.35; 'there': 0.35; 'version': 0.36; 'really': 0.36; 'data,': 0.36; 'changing': 0.37; 'error.': 0.37; 'nov': 0.38; 'stopped': 0.38; 'to:addr:python- list': 0.38; 'that,': 0.38; 'anything': 0.39; 'flow': 0.39; 'to:addr:python.org': 0.39; 'how': 0.40; 'easy': 0.60; 'most': 0.60; 'free': 0.61; 'new': 0.61; 'become': 0.64; 'more': 0.64; 'subject:. ': 0.67; '20,': 0.68; 'yourself': 0.78; 'etc,': 0.84; 'flexibility,': 0.84; "it'd": 0.84; 'pike': 0.84; 'state.': 0.95; 'subject:2013': 0.95; '2013': 0.98 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=j3Df98Sv+tw8KiNk1iklvABN+x5o0OQvXwBwLkgFQf8=; b=YiWo5XFm0trFuwLDob9gd1nOlq1GQLxE+rDwuukaQZSNgFg+a4BTkYyri5RxYB9DWH JrXZFSXpmnmzOBgx1G5O94FiKfao/xX8bYJbfokd5mBrbHD3iEupPUNsatZDOroxe3RV RNJBCscnGE4TeX2B+6nrlqJUrFdZgqC0th3G7FpLsIRfd6Lls07tCG/jyjIDIbISRIBr VLeUaizg/UrqeGHw9u9uKTcCpxlaEHAE/uRvQ1dCbBokSul0zjcFWk/J0lCrgnFX4aRv NCbxRgGqZ0zzSOdTee54bNLtXWrc+AxNie+47JCIPD2ebqq5t3AD0O1/6roXi37VOwYA cI6Q== MIME-Version: 1.0 X-Received: by 10.68.189.34 with SMTP id gf2mr20911175pbc.91.1384902106791; Tue, 19 Nov 2013 15:01:46 -0800 (PST) In-Reply-To: References: <87fvqs6pns.fsf@sable.mobileactivedefense.com> Date: Wed, 20 Nov 2013 10:01:46 +1100 Subject: Re: Several Topics - Nov. 19, 2013 From: Chris Angelico To: python-list@python.org Content-Type: text/plain; charset=ISO-8859-1 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: 31 NNTP-Posting-Host: 2001:888:2000:d::a6 X-Trace: 1384902110 news.xs4all.nl 16003 [2001:888:2000:d::a6]:55763 X-Complaints-To: abuse@xs4all.nl Xref: csiph.com comp.lang.python:60041 On Wed, Nov 20, 2013 at 9:43 AM, glen herrmannsfeldt wrote: > I also used to use a BASIC system that allowed you to stop a program > (or the program stopped itself), change statements (fix bugs) and > continue on from where it stopped. Not all can do that, but pretty > much compilers never do. Ditto, both in GW-BASIC and Q-BASIC, but in each case there were some fairly strict rules about what could be edited. Changing anything to do with control flow quickly got you a "Can't continue" error. And of course, assembly language with DEBUG.EXE lets you do basically anything... rewrite memory (code or data, there's no difference), change the instruction pointer (so execution resumes somewhere else), change other registers, etc, etc. Most languages don't give you quite that much flexibility, because it's really REALLY easy to mess things up and confuse yourself completely. Python kinda will, though; all you have to do is fiddle with sys.modules so it won't be cached, or rename the file to something unique before reimporting it. You can then patch in functions from the new module and start using them. Pike makes this sort of thing much more convenient; it's not hard to write code that smoothly slides to a new version of itself, without losing any sort of state. But the granularity never gets down below the function, meaning the Python and Pike compilers/interpreters are free to fiddle around inside a function (note, for instance, how Python locals basically just become indices into an array; it'd be a bit awkward to tweak a running Python function and add a 'global' declaration). ChrisA (See? I'm posting on topic!)