Path: csiph.com!usenet.pasdenom.info!dedibox.gegeweb.org!gegeweb.eu!nntpfeed.proxad.net!proxad.net!feeder2-2.proxad.net!npeer.de.kpn-eurorings.net!npeer-ng0.de.kpn-eurorings.net!news.tele.dk!news.tele.dk!small.news.tele.dk!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.000 X-Spam-Evidence: '*H*': 1.00; '*S*': 0.00; 'python,': 0.02; 'win32': 0.03; 'interpreter': 0.05; 'that?': 0.05; 'subject:Python': 0.06; '(python': 0.07; "subject:' ": 0.07; 'string': 0.09; 'boundaries': 0.09; 'subject:Does': 0.09; 'worked,': 0.09; 'python': 0.11; 'language,': 0.12; 'character.': 0.16; 'from:addr:rosuav': 0.16; 'from:name:chris angelico': 0.16; 'increment': 0.16; 'seconds,': 0.16; 'sense,': 0.16; 'slight': 0.16; 'subject:programming': 0.16; 'time).': 0.16; 'language': 0.16; 'wrote:': 0.18; 'bit': 0.19; 'things.': 0.19; 'thu,': 0.19; 'seems': 0.21; '>>>': 0.22; 'aug': 0.22; 'fine': 0.24; "haven't": 0.24; 'compiled': 0.26; 'header:In- Reply-To:1': 0.27; "doesn't": 0.30; 'characters': 0.30; 'message- id:@mail.gmail.com': 0.30; 'skip:( 20': 0.30; 'code': 0.31; 'long.': 0.31; 'sep': 0.31; 'yields': 0.31; 'languages': 0.32; 'quite': 0.32; 'running': 0.33; 'maybe': 0.34; 'something': 0.35; '(2)': 0.35; 'test': 0.35; 'but': 0.35; 'received:google.com': 0.35; 'add': 0.35; 'indexed': 0.36; 'subject:?': 0.36; 'similar': 0.36; 'two': 0.37; 'e.g.': 0.38; 'easiest': 0.38; 'work?': 0.38; 'to:addr:python-list': 0.38; 'pm,': 0.38; 'that,': 0.38; 'sure': 0.39; 'to:addr:python.org': 0.39; 'either': 0.39; 'release': 0.40; 'range': 0.61; 'more': 0.64; 'different': 0.65; 'between': 0.67; 'counts': 0.83; 'characters,': 0.84; 'compiling': 0.84; 'pike': 0.84; 'world!"': 0.84; 'wait,': 0.93; '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:content-transfer-encoding; bh=VAkee6UH6Hzcx2kYM87753vf+cKxpIUEavnh5vpHurA=; b=m69RpZisvgybyiVjvujVTuequdaSUNjsDtIABS/NQssiB+k3jOUeZHQthXolhushtT 8TAJCsVQ1u1IS1VtUF4YEONP/5Y299GXy7YasqdLQiEpoKDXLt19L/0V7Qc9SbIB5zkK HtpHCmqkfQIt5MBk0KiCbjbY3hIQhuk/VQztRL2MBlAebLqn0RXdG3qF+6nragOU7zl8 CM/Poj3BnM0BTQKk2RhrAp26EQml8ibgnVsNJSPspn/scofPnzdgOa3HINOx+7/Vr2yj sC1BYvvzGE9giX2RSLInKrtxFTpBFX1jsVl+cQiKk8lLzUKMLvrG3rnuWk2GqgiefXF9 TsPw== MIME-Version: 1.0 X-Received: by 10.220.43.19 with SMTP id u19mr908752vce.3.1375381807645; Thu, 01 Aug 2013 11:30:07 -0700 (PDT) In-Reply-To: <6b1769f8-222b-4953-99c8-a1d73cec3d60@googlegroups.com> References: <6b1769f8-222b-4953-99c8-a1d73cec3d60@googlegroups.com> Date: Thu, 1 Aug 2013 19:30:07 +0100 Subject: Re: Does Python 'enable' poke and hope programming? From: Chris Angelico To: python-list@python.org Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable 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: 35 NNTP-Posting-Host: 2001:888:2000:d::a6 X-Trace: 1375381810 news.xs4all.nl 15876 [2001:888:2000:d::a6]:52649 X-Complaints-To: abuse@xs4all.nl Xref: csiph.com comp.lang.python:51753 On Thu, Aug 1, 2013 at 6:57 PM, CM wrote: > It seems that if I can make a change to the code and then immediately tes= t it by running the Python interpreter and finding out, in a few seconds, i= f it worked, I am going to be *much* more likely to use this trial-and-erro= r approach than if I had to use a compiled language, since compiling takes = so long. E.g. "Oh, that doesn't work? Maybe if I add this...no. OK, what= about if I increment that? No...OK, wait, maybe this...AH! That worked."= (obviously it is not quite that uninformed all the time). I would say that, often, that's a fine way to do things. With two very similar languages I work with (Python and Pike), there's a slight difference in the interpretation of a range subscript: Pike v7.8 release 700 running Hilfe v3.5 (Incremental Pike Frontend) > "Hello, world!"[..5]; (1) Result: "Hello," > "Hello, world!"[5..]; (2) Result: ", world!" Python 3.3.0 (v3.3.0:bd8afb90ebf2, Sep 29 2012, 10:55:48) [MSC v.1600 32 bit (Intel)] on win32 >>> "Hello, world!"[:5] 'Hello' >>> "Hello, world!"[5:] ', world!' Python counts the boundaries between characters, Pike counts the characters themselves. So using the same number on different sides of the colon yields the exact same string in Python, but in Pike, both strings contain the indexed character. Both ways make sense, and the easiest way to make sure I haven't mucked something up - in either language - is to try it. ChrisA