On Wed, Oct 21, 2020 at 1:03 PM David Mertz <mertz@gnosis.cx> wrote:
On Tue, Oct 20, 2020, 9:17 PM Chris Angelico
Please explain how it's "spooky action at a distance" if it's a self-contained assignment statement?
I'm not Steven, but I think I'm the first one in the thread to use Einstein's phrase. As I understand your current semantics, that phrase is not the problem.
My initial impression of your intent was:
foo, bar = 42, 99 # ... a million lines ... line = "123/" # ... more lines ... f"{foo}/{bar}" = line # raises if bar wasn't previously set # binds to prior value if it was set
But I think what you want is for the binding line never to raise, but also not to have any local means to know whether 'bar' is a name after that line. Or whether 'foo' is, for that matter.
Easy: it always is. Whether it has had a value assigned to it is a separate consideration. Consider: if cond: x = 1 Is x a name after this line? Yes, yes it is. There's nothing spooky happening here. ChrisA