Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.python > #51753
| References | <6b1769f8-222b-4953-99c8-a1d73cec3d60@googlegroups.com> |
|---|---|
| Date | 2013-08-01 19:30 +0100 |
| Subject | Re: Does Python 'enable' poke and hope programming? |
| From | Chris Angelico <rosuav@gmail.com> |
| Newsgroups | comp.lang.python |
| Message-ID | <mailman.89.1375381810.1251.python-list@python.org> (permalink) |
On Thu, Aug 1, 2013 at 6:57 PM, CM <cmpython@gmail.com> wrote: > It seems that if I can make a change to the code and then immediately test it by running the Python interpreter and finding out, in a few seconds, if it worked, I am going to be *much* more likely to use this trial-and-error 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
Back to comp.lang.python | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
Does Python 'enable' poke and hope programming? CM <cmpython@gmail.com> - 2013-08-01 10:57 -0700
Re: Does Python 'enable' poke and hope programming? Neil Cerutti <neilc@norwich.edu> - 2013-08-01 18:08 +0000
Re: Does Python 'enable' poke and hope programming? Chris Angelico <rosuav@gmail.com> - 2013-08-01 19:30 +0100
Re: Does Python 'enable' poke and hope programming? Dave Angel <davea@davea.name> - 2013-08-01 19:58 +0000
Re: Does Python 'enable' poke and hope programming? Sam Whitehead <demon.exh@gmail.com> - 2013-08-01 17:52 -0700
Re: Does Python 'enable' poke and hope programming? Vito De Tullio <vito.detullio@gmail.com> - 2013-08-02 05:34 +0200
Re: Does Python 'enable' poke and hope programming? Wayne Werner <wayne@waynewerner.com> - 2013-08-03 07:49 -0500
Re: Does Python 'enable' poke and hope programming? CM <cmpython@gmail.com> - 2013-08-03 10:30 -0700
Re: Does Python 'enable' poke and hope programming? Chris Angelico <rosuav@gmail.com> - 2013-08-03 18:39 +0100
Re: Does Python 'enable' poke and hope programming? Ethan Furman <ethan@stoneleaf.us> - 2013-08-03 11:31 -0700
csiph-web