Description
In the following Python code:
def aaa():
bbb = 0
ccc = 0
ddd = 0
When you say "two states backward"
from ddd = 0
, you get ccc = 0
past ddd = 0
, but you probably expect to get the function def aaa()
past ddd = 0
. The reason for the current behavior is that both the function and ccc = 0
end at the same position, and we yield the smaller scope first. For this case, we would prefer to yield the larger scope first.
However, in the desired implementation for #1057, we'd have the following:
aaa(bbb, ccc)
#!1 ^^^^^^^^
#!2 ^^^^
#!3 ^^^
So if you said "two small paints backward"
from ccc
, today's behavior would give you bbb, ccc
, which is probably what you want, but yielding larger scope first would give you aaa(bbb, ccc
, which is probably not what you want.
There's something non-obvious here. It almost feels like you want to take into account iteration scope. In the latter example, you're crossing an iteration scope boundary, whereas in the former you're not
Note also that in the following case:
foo(bar baz)
#!1 ^^^^^^^
#!2 ^^^
#!3 ^^^
#!4 ^^^^
#!5 ************
#!6 *******
If you're on foo
, I'd expect "every small paint"
to give foo(bar
and baz)
, rather than foo(bar
and baz
. So in this case, we want the bigger scope for that second scope. But on bar
I'd expect to get bar
and baz
. Again seems to have something to do with iteration scope 🤔. Almost feels like scopes should be associated with an iteration scope, which is kind of a move toward our earlier attempts to handle iteration