As part of his massive Python Masterclass article, Kunal Deo drew up some golden rules when working with Python. Click here to jump straight to the article, or add a few of your own golden rules in the comments thread below…
Keep it simple
“Things should be as simple as possible, but no simpler.” (Einstein)
Do one thing well
The UNIX Philosophy certainly applies here.
Don’t fret too much about performance – plan to optimise later when needed.
Go with it
Don’t fight the environment and go with the flow.
Don’t try for perfection because ‘good enough’ is often just that.
(Hence) it’s okay to cut corners sometimes, especially if you plan to optimise later.
Learn from the masters
Borrow ideas from elsewhere whenever it makes sense.
The Python implementation should not be tied to a particular platform. It’s okay if some functionality is not always available, but the core should work everywhere.
Stop bugging me (that’s Window’s job)
Don’t bother users with details that the machine can handle.
A large complex system should have multiple levels of extensibility. This maximizes the opportunities for users, sophisticated or not, to help themselves.
Errors should not be fatal. That is, user code should be able to recover from error conditions as long as the virtual machine is still functional. At the same time, errors should not pass silently.
A bug in the user’s Python code should not be allowed to lead to undefined behavior of the Python interpreter; a core dump is never the user’s fault.
You can find Linux User & Developer’s Python Development Masterclass here.