posting code snippets

Chris Angelico rosuav at gmail.com
Fri Feb 28 06:41:28 CET 2014


On Fri, Feb 28, 2014 at 9:15 AM, Ben Finney <ben+python at benfinney.id.au> wrote:
> Since you'll be posting the code in-line, make sure it's short. Since
> it'll be short, make sure it's complete — we should need nothing else to
> run the code and expect to see the same behaviour you're seeing.
>
> Since you'll be making it short, complete, and still demonstrating the
> behaviour, you may even get the result that you understand the cause of
> the behaviour before posting it. Everyone wins! :-)

Which is the scientific basis of the astonishingly successful (that
is, it's astonishing to people who don't understand) debugging
technique of Rubber Ducking, or talking to your teddy bear, or other
variants of the subject. (I have a figurine from American McGee's
"Alice: Madness Returns" who is extremely helpful to me. She's pretty,
she's smart, and she's pretty smart.) By the time you've explained it
to someone, you've boiled the problem down into a manageable form, and
that often helps you solve the problem yourself.

The problem does have to believe that the rubber duck/teddy
bear/figurine is an expert, though. I've had my siblings or parents
come to me with problems and, without saying a word or touching the
computer or anything, I've solved them. The problem itself respects my
skill, and retracts its objection and solves itself. Why this works I
am not sure, but just remember to treat your teddy bear as an
intelligent partner in the debugging process, not as an idiot who just
gets in the way. He's a brilliant programmer from another dimension;
he knows all about coding, but not about your code, so you have to
explain its little oddities to him. (Or her. Female teddy bears are
just as good at debugging as male ones are.)

ChrisA



More information about the Python-list mailing list