[Python-ideas] Jump to function as an an alternative to call function

Jonathan Fine jfine2358 at gmail.com
Wed Aug 15 16:19:15 EDT 2018


Hi Jacob

Thank you for your problem. I'll focus on your simple example (lightly
edited for clarity)

> Let foo(a, b) be the syntax to call foo(a, b), and foo(a, b)% be the syntax to jump to foo(a, b)
>
> c = 5
>
> def foo(a):
>         return a + c
>
> def bar(a, c):
>         return foo(a)
>
> def bazz(a, c):
>         return foo(a)%
>
> call = bar(1, 3) # 6, being 1 + 5
> bazz(1, 3) # 4, being 1 + 3

This may allow you to solve your verb and morpheme problem. But I hope
there's an easier way. One that can be done using Python as it is now.

My understanding is that you want a stack. Similar to the Python's
function call stack, but with something extra. So that functions
execute in an richer context.

Here's an idea. Start by giving us a toy example of a calculation
you'd like to do. Then the problem is: how to do this in Python.

By the way, are there any existing Python libraries for this sort of thing?

I hope this helps.

-- 
Jonathan


More information about the Python-ideas mailing list