It’s great to think about language design and ways Python could be improved. But it’s important to consider the stability of the language, the cost of a change, whether the benefits justify the turmoil, and all of the edge cases.
Your proposal was:
hello:
print(f"Hello {name}")
hello(name="World") # Hello World
How do we know that name is a parameter to the function? What is the short version of this function:
You can’t assume that every unassigned variable in a function is a parameter. They have to be explicitly declared. As an example, your definition had two names in the body: print and name. Why was name a parameter but print was not?
You have to think about the detailed semantics of a language change to be sure it makes sense and has strong benefits. Consider uses beyond what you’ve experienced in your code. Look at other code to see how it would be affected.
Also, “explicit is better than implicit “. I think the 3/5 letters for def/ class are well spent. - Though one could argue why it’s def and not func or similar, but that ship has sailed.
I think def is fine. It’s concise, you can type it with one hand, and it sidesteps the problem of whether to call it a “function”, “procedure”, “subroutine”, etc.
Define “better”. If the traditional one is easier to read, and your proposed alternative achieves the same thing, how is it better? What’s the improvement?
If you want to change just because Python’s syntax is old, that’s fine! There’s nothing wrong with that. The new syntax won’t be Python though - it’ll be some entirely new language, incompatible with Python. To get started on that, I would recommend learning about language grammars and grammar compilers, and build yourself a program that can read your new language and output something in a more traditional language (sometimes called a “transpiler”). You then have the freedom to make your new language follow whatever rules you like. This is an INCREDIBLY useful exercise; you will learn an enormous amount about what is good, what is bad, what is ugly, and especially, how backward compatibility works (once you start using your own language and have a few scripts around).
You haven’t yet provided a detailed description of the semantics you are proposing. Until you do, this isn’t a serious proposal. How are the parameters of the function determined? What is the new form of this function?
Inside the function are five names to be looked up: random, greets, print, name, number, and punctuation. The f-string uses four names. Two of them are parameters. How would implicitly defined parameters be determined?
To be direct: I don’t think this is a serious proposal. Determining parameters by what is used in f-strings is a tiny slice of how functions are actually written.
We aren’t going to change for change’s sake. No matter what you say, this is a new syntax, with little specification, and no real benefit.