lambda

Craig Ringer craig at postnewspapers.com.au
Mon Jan 17 22:31:17 EST 2005


On Mon, 2005-01-17 at 12:15 -0300, John Lenton wrote:

> knowledgeable and experienced users know when to ignore the rules.

+1 QOTW

One of the nice things is that Python permits you to do exactly that
where appropriate while avoiding forcing you to do gruesome things to
get a job done.

I think the classic example of your statement is the use of 'goto' in C
and C++ code. Don't use goto - except when there's no other sensible way
to make your code clear. For example, goto and Py_XECREF seem to be very
handy for cleanup after detecting an exception when working with the
Python/C API.

That said, I do think "the rules" deserve consideration and respect -
they're usually there because of many others' experience over time. It's
interesting to learn those lessons first hand, but it's nice to be able
to avoid repeating every single one of them.

--
Craig Ringer




More information about the Python-list mailing list