Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.python > #51750

Re: Does Python 'enable' poke and hope programming?

From Neil Cerutti <neilc@norwich.edu>
Newsgroups comp.lang.python
Subject Re: Does Python 'enable' poke and hope programming?
Date 2013-08-01 18:08 +0000
Organization Norwich University
Message-ID <b5vmgnFa9nkU1@mid.individual.net> (permalink)
References <6b1769f8-222b-4953-99c8-a1d73cec3d60@googlegroups.com>

Show all headers | View raw


On 2013-08-01, CM <cmpython@gmail.com> wrote:
> http://en.wikipedia.org/wiki/Programming_by_permutation
>
> 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).
>
> Instead, with a compiled language, because of the pain of
> having to wait for the newest version to compile, one would be
> encouraged to get the mechanism of how something works *clear*
> and robustly represented in one's mind (or on scrap paper/notes
> document) prior to testing through compiling and running.

With a big project running all tests for a Python program could
be just as time consuming. If I were using a compiler for my
programs compiling would still be virtually instantaneous.

> I'm sick of this in my own work, and want to avoid this trap as
> much as I can from now on.

When I "know", for example. that it's an off-by-one error, I'm
pretty guilty of just making the change and re-running the test.
I think it's cool! If my test sucks, then I wasted my time, of
course.

As I said, I disagree that the speed of using an interpreter is
the main issue. Changing certain things, even big things, in a
Python program is often much easier than changing something in ,
say, a C program, due to Duck-Typing and dynamic typing. So
experimentation is easier thanks to more maleable code.

-- 
Neil Cerutti

Back to comp.lang.python | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


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