On Sat, 13 Jun 2020 at 13:54, artem6191 <[email protected]> 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
_______________________________________________
Python-ideas mailing list -- [email protected]
To unsubscribe send an email to [email protected]
https://mail.python.org/mailman3/lists/python-ideas.python.org/
Message archived at 
https://mail.python.org/archives/list/[email protected]/message/JHT36C2VJGY37OCUQJVGSRMFQOAYD4A3/
Code of Conduct: http://python.org/psf/codeofconduct/

Reply via email to