I think you're all overthinking this. We want a notation that:
1. Makes it clear attribute access won't work
2. Indicates where the nested definition really lives
3. Gives a reasonable error message if you do try to evaluate it"f.<locals>.g" ticks all those boxes, so it's fine.