[Tutor] Help

Steven D'Aprano steve at pearwood.info
Fri Sep 21 17:33:43 CEST 2012


On 22/09/12 01:18, Jerry Hill wrote:
> On Fri, Sep 21, 2012 at 10:33 AM, Prasad, Ramit
> <ramit.prasad at jpmorgan.com>  wrote:
>> Ironically, that describes me. So what is the preference for large
>> code samples? Just always include it? What about for the main list?
>
> It's tricky.
>
> Ideally, you need to take your large code base, and reduce it into a
> short piece of sample code that is runnable and reproduces your issue.

+10000 on this.

See also:

http://sscce.org/

But, suppose you try really hard, and the shortest you can get your code
down is 200 lines (for example). What then?

There is no good answer. Speaking for myself, I would prefer that you
attach the file to your email. But others will be unhappy if you do
that, and will prefer that you use a pastebin. But if you use a pastebin,
I will be unhappy (I am probably not the only one). So whatever you do,
you will make somebody unhappy.

Oh well, that's life.



> In many cases, the act of trimming your code down to that form will
> actually cause you to find the answer to your own question without
> even needing to send it.  This process is sometimes known as "rubber
> ducking" -- http://www.codinghorror.com/blog/2012/03/rubber-duck-problem-solving.html
>
> I can't count the number of times that I've had a problem, decided to
> send it to a mailing list for help, and in the process of fully
> describing the problem I'm having, come up with the solution without
> even having to send the email.

I second that. Just the other day, I was puzzling over how to do something
in Python, involving the signal module. By the time I had written a *short*
(less than twenty lines) example showing what I was trying to do, I had
worked out how to do it and didn't need to send the email.

This was not an unusual case.



-- 
Steven


More information about the Tutor mailing list