If I understand well the need (I'm unsure I've had it myself), it would
be easier to be able to import the function in the active context, like
this:
def foo(a):
return a + c
def bar(a, c):
return foo(a)
def bazz(a, c):
import __file__.foo
return foo(a)
c = 5
call = bar(1, 3) # -> 6
jump = bazz(1, 3) # -> 4
bazz would be equivalent to:
def bazz(a, c):
def foo(a):
return a + c
return foo(a)
I'm not saying the syntax is the one that should be used (__file__
possibly not existing may be a problem), not even saying that we should
have this. I'm just showing a way to do the same thing with an easier
(to me) syntax.
- Brice
_______________________________________________
Python-ideas mailing list
Python-ideas@python.org
https://mail.python.org/mailman/listinfo/python-ideas
Code of Conduct: http://python.org/psf/codeofconduct/