Io Style Guide

» A quick look at the Io style guide and how it applies to other languages like Python.

Io Style Guide. It's interesting to see how some points apply to Python as well, while others don't match very well at all.

For example, using setters all the time might make great sense in Io (and Java, etc), but I rarely see them used in Python this way. In fact, the presence of many setters usually indicates "unpythonic" code. Especially if those setters don't do anything besides just setting the attribute's value.

Similarly, "always return self in the absence of any other useful value, allowing other object methods to be chained together", makes perfect sense in Io, but less so in other languages. As far as I can tell, Python methods aren't chained all that often (except maybe string methods etc), and I hear that it's considered "not done" in Java.

Other advice can be applied to Python (and probably many other languages) as well... like the part about direct assignment on external objects ("let the external object decide how to affect its own state"), or the spreadsheet example (although I often see classes that include import/export methods as well, and I've probably been guilty of writing them).

These guidelines are more about coding rather than style, really... except for the part about method names. I personally hate methodNames likeThis, but in the end it's just a matter of taste.