Python Effective Programming

來源:互聯網
上載者:User
文章目錄
  • HTML Tags and JavaScript tutorial
 

HTML Tags and JavaScript tutorial


Python Effective Programming

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

相關文章

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.