Successfully reported this slideshow.
We use your LinkedIn profile and activity data to personalize ads and to show you more relevant ads. You can change your ad preferences anytime.



Published on

Published in: Technology
  • Be the first to comment

  • Be the first to like this


  1. 1. Introduction to Python“To describe something as clever is NOT considereda compliment in the Python culture.” Alex Martelli, PythonCookbook (2nd ed., p. 230) Prepared by: Amgad Mohamed | Hussein Mohamed | Yasser Mohsen
  2. 2. Brief Introduction– Python is a general-purpose, high-level programming language whose design philosophy emphasizes code readability.– Python claims to "combine remarkable power with very clear syntax", along with a huge standard library with the uniqueness of using indentation as a block delimiters.– Python had three major releases to support multiple programming paradigms including Object Oriented Programming, Imperative programming and Functional programming. Additionally, it features a fully dynamic typing systems and automatic garbage collection.
  3. 3. Quick History– Python was conceived in the late 1980s, and its implementation was started in December 1989 by Guido van Rossum.– Python 2.0 was released on 16 October 2000, with many major new features including a full garbage collector and support for Unicode.– Python 3.0 (also known as Python 3000 or py3k), a major, backwards-incompatible release, was released on 3 December 2008. • Python 3.0 was developed with the same philosophy as in prior versions. However, as Python had accumulated new and redundant ways to program the same task, Python 3.0 had an emphasis on removing duplicative constructs and modules, in keeping with "There should be one and preferably only one obvious way to do it".
  4. 4. Advantages / Disadvantages I. Supports multiple paradigms. II. Less code To Achieve More (Expressiveness) III. Support Libraries (Extendibility) IV. High productivity A. Less time to code and since there is no compilation step; the edit- test-debug cycle is incredibly fast. B. Anecdotal evidence suggests that one Python programmer can finish in two months what two C++ programmers cant complete in a year, Python code is often 5-10 times shorter than equivalent C++ code. C. Python programs are typically 3-5 times shorter than equivalent Java programs. V. Auto Memory Management and Exception Handling.I. Compared to other programming languages, Python performance (timeand space), is way behind, Hard to Translate, and lack of documentation.
  5. 5. Benchmarking
  6. 6. Translation– Python Code is compiled to byte code similar to Java, and then this Byte code is interpreted to the underlying machine language. (Pseudo Interpreter)– This byte code provides • portability. • speed execution - byte code can be run much more quickly than the original source code
  7. 7. Sample Code - GCDdef gcd(a, b): "greatest common divisor" while a != 0: a, b = b%a, a # parallel assignment return b
  8. 8. Zen of Python (Easter Egg)• Beautiful is better than ugly.• Explicit is better than implicit.• Simple is better than complex.• Complex is better than complicated.• Flat is better than nested.• Sparse is better than dense.• Readability counts.• Special cases arent special enough to break the rules.• Although practicality beats purity.• Errors should never pass silently• Unless explicitly silenced.• In the face of ambiguity, refuse the temptation to guess.• There should be one-- and preferably only one --obvious way to do it.• Although that way may not be obvious at first unless youre Dutch.• Now is better than never.• Although never is often better than *right* now.• If the implementation is hard to explain, its a bad idea.• If the implementation is easy to explain, it may be a good idea.• Namespaces are one honking great idea -- lets do more of those!
  9. 9. References• [1] Retrieved 2011-10-04• [2] Python documentation. Retrieved 2011-10-04.• [3] Retrieved 2011-10-04• [4] Retrieved 2011-10-04• [5] Retrieved 2011-10-04• [6] Retrieved 2011-10-04• [7] ython.pdf• [8] Learning Python 4th Ed, Mark Lutz• [9] Core Python Programming 2nd Edition, Wesley J. Chun - Sep 2006• [10] Python Enhancement Proposals, 20 -- The Zen of Python.