14 Jun
2020
14 Jun
'20
7:16 a.m.
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