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. Of course, you could test the name, e.g.: try: bar except: bar = remediate() But that's cumbersome. Overall, I'd find the spooky action at a distance less troubling. In contrast, this is straightforward: line = "123/" pat = "{foo}/{bar}" dct = scan2dict(pat, line) It's either going to create a dictionary of raise an exception. Or maybe a version of the function might make a dataclass or namedtuple instead. I'm not sure exactly what the pattern language might look like, but whatever its details, everything is locally available.