Skip to main content
7 events
when toggle format what by license comment
Jul 10, 2016 at 18:43 comment added machine yearning That's an excellent suggestion,
Jul 9, 2016 at 3:45 comment added njzk2 I'd suggest set(row) == required_nums(board) instead of all(n in row for n in required_nums(board)) with required_nums returning a set.
Jul 8, 2016 at 15:06 comment added machine yearning @StewieGriffin Zen of python #5: Flat is better than nested
Jul 8, 2016 at 10:49 comment added machine yearning Just think of it as a nested for loop in one line. Or if you're a mathematician, read it like set builder notation. There's a slight learning curve but list comprehensions are both idiomatic and useful, when used properly. Of course they can get hard to read if you abuse them, but as a rule of thumb if you can fit it on one line (with descriptive variable names) then someone familiar with the construct should be able to read it as easily as they would a nested for loop.
Jul 8, 2016 at 10:30 comment added Stewie Griffin I do think these statements are a bit hard on the eye though: return [item for sublist in list2d for item in sublist]. It's almost like I have to write it down on paper to see what's going on...
Jul 8, 2016 at 10:16 review First posts
Jul 8, 2016 at 10:21
Jul 8, 2016 at 10:13 history answered machine yearning CC BY-SA 3.0