Ticket #284 (closed defect: fixed)
No exception for insufficient multi-variable assignments in lists and arrays
Reported by: | jaegs | Owned by: | |
---|---|---|---|
Priority: | medium | Milestone: | |
Component: | Cobra Compiler | Version: | 0.8.0 |
Keywords: | multi-target assignment | Cc: |
Description
As expected this throws an exception
a,b = 1,2,3 #error: The number of targets (2) must be the same as the number of expressions (3) assigned to them
This is not true for Lists and Arrays
a,b = [1,2,3] # a=1, b=2 c,d = @[1,2,3] # c=1, d=2
No exception. The 3rd element is silently ignored. This is also inconsistent with Python.
a,b = [1,2,3] #ValueError: too many values to unpack
Change History
Note: See
TracTickets for help on using
tickets.