On Tue, 11 Jul 2000, Greg Ewing wrote: > Thomas> '[' [testlist [list_iter]] ']' > Thomas> Should that really be 'testlist'? > [...] > if it were changed I expect > you'd get complaints that things like > > [x,y for x in (1,2,3) for y in (4,5,6)] Well, i imagine this would yield [x, 4, 5, 6, 4, 5, 6, 4, 5, 6] right? I think i vote for "produce parens only if i write parens". Hmm, another question. When someone writes: [x, y for x in 1, 2, 3 for y in 4, 5, 6] ...what should they get? (a) SyntaxError (b) [(1, 4), (1, 5), (1, 6), (2, 4), (2, 5), (2, 6), (3, 4), (3, 5), (3, 6)] (c) [x, 4, 5, 6, 4, 5, 6, 4, 5, 6] (d) [x, y, 2, 3, 5, 6] If we go with above rule of "produce parens only if i write parens", then the answer has to be (d). That is, commas bind last in a list (which seems consistent with normal practice...). Does this make sense or seem confusing to you? If it's too confusing, we can choose (a) and require that the first part of a list comprehension has to be a single test. -- ?!ng
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4