def is_between(n1,n2,n3):
fn"is number {n1} between {n2} and {n3}"
fn"{n2}<{n1}<{n3}?"
The token “fn” immediately following the def statement, specify descriptive text, about the function arguments and how the function can be invoked.
Multiple “fn” specifiers describes multiple ways the function can be invoked.
The “fn” statement is at the same indentation level as the def statement’’’
if “fn” statements are found indented and not immediately following def statement, indicate function invocation.
function can be invoked using descriptive text specified in “fn” statement.
if fn"is number {value} between {valid} and {low_threshold}": print("underflow")
if is_between(value,low_threshold,high_threshold): print("in range")
if fn"{low_threshold}>{value}>{high_threshold}?" print("overflow")
the “fn” specifier serves as MCP protocol description, specification. The interpreter can use LLMs to convert “fn” invocation string and match it with the “fn” specification and make tool calling in-built into native python language.
PEP-able? I would say no because the proposal violates many rules of Python syntax. Also, interpreter cannot/will not use LLMs.
Moderators: I think this should be moved to Help as the proposal is not a plausible change to current Python, but might be worth some discussion as to ideas for different interfaces built on top of Python.
I know invoking LLMs was a long shot, even if we have a literal match I believe it is still valuable.
The fn syntax proposed is exactly same as the f-string, can you please point me to the syntax rules that it violates.
Also do you have any suggestions about other interfaces build on top of Python ? (is DocStrings one such option)