On 2021-10-18 11:20, Mathew Elman wrote:
I don't know if this has been suggested before, or if this is outlandishly
impossible (though I would be surprised if it was), so apologies in advance if
so.
I have on occasion come across a situation where I use/write a signature like
this:
def insert_x_into_y(x, y):
...
or worse
def insert_into(item, container):
...
where, despite a driving idea of python syntax being readability in english,
the function signature is distinctly not english.
"I'll just go and insert into this item that container", is not only never said
but is actually ambiguous in english.
What would be really cool, is if python let you write function signatures like
this:
def insert_(item)_into_(container):
...
where the arguments dispersed between the function name are positional only
argument, and any key word arguments would have to go at the end.
It would create a function that could be called as:
insert_(1)_into_(my_list)
or
insert__into_(1, my_list)
[snip]
It looks like what you want is the Smalltalk language.
_______________________________________________
Python-ideas mailing list -- python-ideas@python.org
To unsubscribe send an email to python-ideas-le...@python.org
https://mail.python.org/mailman3/lists/python-ideas.python.org/
Message archived at
https://mail.python.org/archives/list/python-ideas@python.org/message/BZHMDPWR63FHY6YG6ZOXXZ55CWMHH2YF/
Code of Conduct: http://python.org/psf/codeofconduct/