Paul Moore writes:
> 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 :-)
I think it's an interesting idea, although I'm with Alex on the color
of the bikeshed. Using Alex's 'in' and sets instead of sequences,
consider
def food() in {2}:
return 2
def bar(n in {1, 2, 3}):
pass
def main():
bar(food()) # Paul doesn't think it tastes so great. :-)
That could be checked by MyPy, without global dataflow analysis.
Maybe
def foo() -> {1, 2, 3}:
return 2
is more readable, and probably just as implementable.
Steve
_______________________________________________
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/TGSWHQ3PYT5MJ4Z2Q2FPWXYDW5JXYDPB/
Code of Conduct: http://python.org/psf/codeofconduct/