2 ms·
Well written. Though it seems the whole article could have been said more concisely as: "Guido's decision is wrong because it causes Python to use more resour
by mkramlich 18y ago
Well written.
Though it seems the whole article could have been said more concisely as:
"Guido's decision is wrong because it causes Python to use more resources than necessary in certain cases." [where resources is any one of: stack, heap, file descriptors, etc.]
Which is non-ideal, in isolation, certainly. But Guido's whole post was about saying there are trade-offs, and he doesn't like the trade-off made in the other direction. (Misleading stack traces, etc.) Guido does seem to understand both sides of the argument. But ultimately it is a design decision. And he made it.
- Shamiq 18y agoGotcha. Thanks.
- allertonm 18y agoAlmost, there is one unstated additional qualification: all the above is only true if you don't believe in (or cannot use) boring old iterative loops and must implement an algorithm recursively. I found it hard to believe the article went to the extent of explaining TCO (with assembly language!) and space complexity without bothering to mention this little assumption. Since Python favours iteration over recursion I have some sympathy with GVR on this one.
- wingo 18y agoThe "Lambda: The Ultimate GOTO" paper shows a still-timely example of when you might want to express a state machine as mutually recursive functions. Granted, they compare to the actual GOTO, but you can't make state machines of any manageable size with iteration, either.