4 ms·
Threading in cPython is like recursion, it kind of works but is not the canonical way to write it. I dare to say that in Python you should always convert a rec
by scardine 13y ago
Threading in cPython is like recursion, it kind of works but is not the canonical way to write it.
I dare to say that in Python you should always convert a recursive algorithm to the iterative form, because cPython lacks tail call optimization common in functional languages and the default recursion dept is only 999; the same way you should also look for other patterns related to multitasking if the task is CPU bound (or look for GIL-free implementation).
I agree with you that these (and other) Python "gotchas" need more visibility; I don't think the language is broken - one could say the default implementation is broken, IMHO it is just not optimized for a couple classic software patterns. Once you start swimming with the current (using alternative patterns), you probably will find some of the design decisions very pragmatic.