News

Python development – the golden rules

As part of his Python Development Masterclass, Kunal Deo drew up some golden rules when working with Python. Have you got any Python gems to share?

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!
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.

No-one’s Perfect
Don’t try for perfection because ‘good enough’ is often just that.

Minor shortcut
(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.

Think Cross-platform
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.

Extensibility
A large complex system should have multiple levels of extensibility. This maximizes the opportunities for users, sophisticated or not, to help themselves.

Senseless fatalities
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.

Bug off
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.

[twitter username=”linuxusermag”]

×