10.5. Summary

Python is a great language in which to write elegant and clean code. Writing clean code is the best way to avoid bugs in the first place and it gives you a feeling that you know what happens in your program at all times. Consequently finding any bugs is easier and fixes are simpler. Naturally the sense for elegant code is something that needs lots of hands-on practice and failures, to develop.

If you feel adventurous, you could take a look at the Python source code and find out how API calls are implemented. This is not as intimidating as it may first sound, since the code is typically understandable and, even if you do not understand it fully, it can point you in the right direction. Luckily PyS60 is open source so this is a real option!

There are often many different ways to accomplish one goal in programming. To get to your goal, you have to make a great number of small decisions. Often, alternatives are technically similar and the difference is mostly a matter of aesthetics. However, style does matter in programming. It makes sense to keep some rules of thumb in mind that may help you write better code.

It may be enlightening and entertaining to read the following short articles:

These articles give deeper insights into issues of coding style in Python. Besides those articles, which discuss the Python language in general, we would like to present some thoughts ...

Get Mobile Python: Rapid Prototyping of Applications on the Mobile Platform now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.