News for hackers. Stuff that matters.
Re:Python's new t-strings by nomel on Tuesday April 22, 2025 @01:48PM (#43764621)
Here's the statement checking code, which I believe is pre-AST [1]. I would have to dig more to see if that check is there to prevent invalid AST or to just "help the user" (would depend on how they reference the original variable I suppose).

But wow, that's the first time I've seen "nonlocal". In the ~100 packages I have installed, I see 0 usages!

[1] https://github.com/python/cpython/blob/a6a3dbb7db0516a72c5ef...

Re:Python's new t-strings by zahlman on Wednesday April 23, 2025 @06:19AM (#43770427)
Well, yes, not a lot of people write closures except perhaps when they implement decorators. So there's ordinarily no non-local scope to worry about. People tend to write classes instead, because that's what's familiar.