On Sat, 13 Jun 2020 at 13:54, artem6191 <artem129871@gmail.com> wrote:
This operator will allow to send arguments to function only by certain values. Example:
def some_function(a > (1, 2,3), b): # Some code some_function(1, 2) some_function(4, 2) # Error "Value '4' is not allowed for argument 'a'"
def some_function(a, b): if not a in (1,2,3): raise ValueError(f"Value {a} os not allowed for argument 'a'") # Some code How is your proposal better than this? It needs to add sufficient extra value to justify the cost of adding new syntax, teaching developers (and IDEs) what the new syntax means, etc. Personally, I find the version I wrote, that works in existing versions of Python, much more readable than your version, so you;d have a hard time persuading me that the new syntax is worth it :-) Paul