Python Effective Programming - Intro

These are some experiences of effective python programming that shown in a slide (http://www.interlink.com.au/anthony/tech/talks/OSCON2005/effective_r27.pdf) on OSCON 2005 by Anthony Baxter (anthony@interlink.com.au). Most of them are of great value I found in everyday's python programming. So I would like to show them here step by step. Thank Anthony and python that they give us interesting experiences in coding in which sometimes there are lots of boring affairs.
 
First of all we should define what is effective programming. Someone would say that it is rapid design, fast coding, no bug, excellent speed and etc. Yes, all of above are elements of great code. But one of the most important and basic things is to get the job done correctly. However fast it runs, wrong is wrong.
 
Maintainability is another key point. Indentation (fortunately this is a nature-born feature of python), meaningful and appropriate comments, consistent naming and clear flow control make up good readability. Code is always on change during the whole procedure of development and it is frustrated when you found that you can not get the meaning of code you wrote and have to read it line by line.
 
Besides of correct logic and nice design, using language's strengths is a tricky way to make the two above point easier and more effective. Python is a language different from C, Perl, Java, Lisp and etc. It has learned a lot from other languages to extent itself during a long time of growth. It has become another C that can do nearly everything from little scripts to huge system and frameworks. Just like C++, you could code in multiple styles: C style, using basic flow control and data structure, somewhat like a super assembly; C++ style or Java style, classical OO style, everything is object, inheritance and polymorphism everywhere; Lisp or Haskell style, functional, charming and complex; Or Perl style, short, mysterious and complicated, $$$$$$$$. But python has its own style:  a nice, clear and elegant. To write python code in this way, a deep understand of all most python features is needed. And then effectiveness would come from your code naturally.

MSN Space Link: http://vanzolo.spaces.msn.com/blog/cns!4A43F3D396FBF12F!1534.entry?_c11_blogpart_blogpart=blogview&_c=blogpart#permalink

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值