-
Notifications
You must be signed in to change notification settings - Fork 4
Open
Labels
enhancementNew feature or requestNew feature or requestpythonInvolves the Python implementationInvolves the Python implementation
Milestone
Description
In Python, you don't need parentheses around tuples all the time. For example,
# Swaps variables
a, b = b, a
# Iterate over list with index
for i, item in enumerate(list_of_items_):
# Return a tuple
return None, FalseCurrently, N requires parentheses around tuple expressions/literals and types (but not patterns, I think). So, currently, the programmer has to write
let a, b: (char, float) = (\{π}, 3.14)I feel like those parentheses around the value and type annotation aren't necessary, so instead, one can just write
let a, b: char, float = \{π}, 3.14Parentheses will still be required inside type variables, lists, function arguments, and other tuples:
let wow: list[(char, float)] = [(\{e}, 2.72), (\{π}, 3.14)]
print((1, (2, 3)))so I don't think allowing their omission should cause any problems.
(I'm adding the Python label because it's not in the Python implementation but it is in the JS implementation as of now; if this feature request gets rejected then I'll have to fix the JS impl.)
Metadata
Metadata
Assignees
Labels
enhancementNew feature or requestNew feature or requestpythonInvolves the Python implementationInvolves the Python implementation