Weird interaction with nested functions inside a decorator-producing function and closuring of outer data...

Steven D'Aprano steve+comp.lang.python at pearwood.info
Wed Aug 24 20:54:55 EDT 2011


Adam Jorgensen wrote:

> Thanks :-) Sorry about the size, I wasn't sure what was relevant...

We prefer that you don't top-post here, because it makes it hard to see
context when people reply.

In general, people asking questions should always try to reduce the problem
to the simplest code that will demonstrate the problem. This has two huge
advantages:

(1) We're all volunteers here, none of us are paid to solve your problems.
The more work needed to answer a question that we might not care that much
about, the less likely it is that you will get good answers. The easier you
make it for us, the more likely you will get many good, prompt answers.

(2) Even more important... the process of cutting out all the irrelevant
details and reducing the code to the smallest possible example may reveal
to you what the problem is.

As the old proverb goes, "solve a coder's problem, and you've solved one
problem... teach a coder how to solve his own problems, and you've solved
them all" *wink*

I can't begin to count how many times I've started writing up a post to ask
a question, and in the process of reducing the example code to the smallest
it can be, I've solved it myself.


-- 
Steven




More information about the Python-list mailing list