Open gvanrossum opened 4 years ago
Good point! Dynamic scoping (walking the frames) and lexical scoping (this static analysis) can overlap, but this is an important distinction. I will look into improving the README (likely the PEP itself) accordingly.
Your README says
It's worse than that: if an interpolation references a nonlocal variable we'd have to walk the chain of closures -- but there's no object that represents that. If the referenced variable exists in a caller's frame that has been GC'ed (because the caller returned), there's no way to recover its value. Real f-strings discover the needed closures during compilation and make them available in cells.