psychopy/psychopy — pull request #379 by toddrjen (2013-08-28 14:57:22+00:00)
Title: Cleanup window.py

Large-scale cleanup of visual/window.py. Includes code formatting cleanup, cleanup of imports, some reorganization of methods, and better type handling (using isinstance or duck-typing where possible).

It also includes explicit handling of None. Previously, "if var == None:" or "if var != None:" was being used. These, however, are equivalent to "if var:" and "if not var", respectively.

In many cases, however, it was clear that actually testing for a value of None was what was expected. This is done by "if var is None" or "if var is not None". Depending on the circumstances I tried to determine whether "if var" or "if var is None" is better.

However, although this can fix obscure bugs (for instance with "var = []", since "[] == None" is True), it is still a potentially backwards-incompatible change. For an explicit backward-compatible change, then "if var" should be used everywhere. But I don't think this is really the correct behavior.

All the other changes should be backwards-compatible.