3 ms·
> basically any functions which needs its own local variables / its own stack. Since cpython's interpreter is stack-based, as long as the function is stack-cle
by masklinn 13y ago
> basically any functions which needs its own local variables / its own stack.
Since cpython's interpreter is stack-based, as long as the function is stack-clean why would it need its own stack?
There is a difficulty with local variables though, especially with inlining conflicts (the inlined locals would need to be munged)
- albertzeyer 13y agoOn the AST level, you have symbol names, so they become ambiguous. E.g. @inline def f(y): x = y + 1 return x def g(): x = 42 f(0) return x print g() would print 1. When you do it on the bytecode level, many things probably would work, although I don't know whether some things might get confused when there are multiple variables with the same name. Also, accessing `locals()` would (of course) not work.
- masklinn 13y agoYes but that has nothing to do with the stack, it has to do with namespace conflicts between local variables.