dcsimg
Linux Today: Linux News On Internet Time.





DevX: Power Python: Do More With Less Code

Jul 21, 2004, 07:00 (2 Talkback[s])
(Other stories by Doug Tillman)

"What's Power Python, you ask? It's the effective use of Python language features to get a lot of work done in fewer lines of code. The lambda, reduce, filter, map, and list comprehension constructs are some of the features that best fit this definition. This article examines each one in turn and highlights some of their strengths with simple code examples that illustrate the basic syntax and usage. It then delves into some related coding advantages that Python offers, such as the easy creation of callbacks and closures.

"The built-in Python functions discussed adhere to some of the basic principles of Functional Programming (FP). While this article doesn't focus on the philosophy of FP per se, it does highlight some of the advantages of the FP style of programming, such as the emphasis on list processing, the use of functions to replace looping, the avoidance of side effects, and the reliance on functions being first class objects. By the end of the article, you should have a strong grasp of how you can use these powerful techniques to write more expressive and concise code in your projects..."

Complete Story

Related Stories: