News for hackers. Stuff that matters.
Re:Norvig's Python programs to practice or demonstrate skills by gary_bernhardt on Monday November 27, 2017 @08:41PM (#15793528)
`set` is a built-in. He probably didn't want to smash it.

Defining a function and immediately calling it prevents pollution of module scope. Without it, `photo` would be exported.

The tests are in the same file because it makes the example self-contained, I assume.

The experiments are run 100,000 times because they have a random component and this exercises the system.

Re:Norvig's Python programs to practice or demonstrate skills by dfee on Monday November 27, 2017 @09:32PM (#15793803)
Please re-read my comment. I understand what he did, but my points stand.

The name `SET` conveys little. Running the exercise in the same file is OK as it’s not in a module, but again - the work demonstrates algorithms well enough, but I can’t see this coding style as “smart” or “clean”. It’s not.

Re:Norvig's Python programs to practice or demonstrate skills by gary_bernhardt on Monday November 27, 2017 @11:15PM (#15794334)
Top of the file:

""" Game of Set (Peter Norvig 2010-2015) """

It's the name of the problem being solved.

Re:Norvig's Python programs to practice or demonstrate skills by dfee on Tuesday November 28, 2017 @12:08AM (#15794592)
Yeah, `game.py` would've been great!