Changes between Version 2 and Version 3 of MultiArgAssign
- Timestamp:
- 11/22/10 19:59:36 (14 years ago)
Legend:
- Unmodified
- Added
- Removed
- Modified
-
MultiArgAssign
v2 v3 3 3 Cobra supports multi variable or multi target assignment 4 4 {{{ 5 #!cobra 5 6 a, b, c = 10, 20, 30 # comma separated list of expressions 6 7 … … 19 20 target and source lists were unrolled and each assignment done individually 20 21 {{{ 22 #!cobra 21 23 a = 10 22 24 b = 20 … … 38 40 39 41 {{{ 42 #!cobra 40 43 # unusual but acceptable - dict keyed by int in range 41 44 dict = {1:'aye', 2:'bee'} … … 66 69 67 70 {{{ 71 #!cobra 68 72 dict = {'x':'aye', 'y':'bee'} 69 73 for k, v in dict … … 76 80 the same size as the list of targets for each step of the enumeration 77 81 {{{ 82 #!cobra 78 83 for i, j in [1, 2, 3, 4] # error 79 84 pass … … 88 93 [wiki:EnumForExpr for expression] 89 94 {{{ 95 #!cobra 90 96 i, j = for x in [1, 2, 3, 4] get x 91 97