"Structural pattern matching" for Python, part 2
"Structural pattern matching" for Python, part 2
Posted Sep 2, 2020 21:32 UTC (Wed) by mathstuf (subscriber, #69389)In reply to: "Structural pattern matching" for Python, part 2 by nybble41
Parent article: "Structural pattern matching" for Python, part 2
Changing variable scope to be anything other than the parent function/class/module declaration would be a massive change. Anything digging around in frame objects would need to learn to poke wherever these new scopes end up being declared. You'd basically need to add variable declarations too since this fairly common pattern would be broken:
if foo is not None:
local_foo = foo
else:
local_foo = DefaultValue()
(Sure, here `foo` could probably be reused, but code like this still exists.)
