4 ms·
> That python code is horrid. Just out of curiosity, why do you find the code horrid? There are really only 9 lines of code that aren't glue code, and apart fr
by lqet 2y ago
> That python code is horrid.
Just out of curiosity, why do you find the code horrid? There are really only 9 lines of code that aren't glue code, and apart from the error prints (which are really irrelevant for these demonstration purposes), the code looks basically fine to me.
EDIT:
seen = []
for b in boards:
if set(seen).isdisjoint(orbit(b)):
seen.append(b)
Ah, well...
EDIT 2: also, see comment below, it's not Python
- mitchellpkt 2y agoedit: nevermind, it's sage code not python code
- IanCal 2y agoIt's not python, it's sage, so those actually work.
- boothby 2y agoSage is a Python (and the snippet you pasted works fine in Python). And I'm also curious what would qualify that code as "horrid." I'd make light suggestion to improve performance by making `seen` a set right off the bat, but for this size of problem, that sort of detail is unimportant. Calling somebody's code "horrid" without even understanding what it's doing isn't a productive approach to, well; anything, really.
- deleted 2y ago[deleted]
- quasarj 2y agoI was primarily offended by the second code snippet, in which there is a variable named foundException but it is not an exception. I didn't realize it was Sage (I didn't know that existed) but I'm not sure that actually makes a difference. Obviously it works, and that's fine, but it's still horribly ugly.