3.38k likes | 8.65k Views
Python Programming Language. b y Vasu Chetty. Origins of Python. Created by: Guido van Rossum , a Dutch Programmer Created during: Christmas Break, 1989 Created because: Guido had some free time and an idea for an interpreter Named after: . Python Through the Ages.
E N D
Python Programming Language by Vasu Chetty
Origins of Python • Created by: Guido van Rossum, a Dutch Programmer • Created during: Christmas Break, 1989 • Created because: Guido had some free time and an idea for an interpreter • Named after:
Python Through the Ages • Version 0: Inheritance, exception handling, functions, and core data types of list, str and dict • Version 1: Lambda, reduce(), filter(), and map() • Version 2: Garbage collection and generators • Version 3: Unification of str/unicode types, statements switched to function calls, and instances of list replaced by views and iterators
Why Python? • Freely available • Well-documented • Fosters rapid development • Very high-level object-oriented language • Integration facilities for mixed-language development
Who uses Python? • Google (e.g. code.google.com was written in Python) • New York Stock Exchange (web-based transaction system) • YouTube • NASA • Other common uses include: RSS readers, CGI applications, generating and analyzing logs, and creating HTML calendars
Python Programming Paradigms(say that 10 times fast) • Object-oriented • Iterative (generators) • Imperative (follows sequential steps) • Functional (lambda calculus)
Common Data Types and Elements • Numbers: integer, floating point, complex • Other: boolean, none, string, tuple, list, dictionary, set • Conditionals: if, else, elif • Loops: while, for • Supports: nested loops, function calls from other functions, string concatenation, combined boolean, string, or integer in conditional with “and” or “or”
Functions in Python • Functions are essentially objects, making them very flexible • Functions are considered as first class, so they can be passed to and from other functions • Return values need not be set, return none statements are implicitly built in • Functions can be nested within other functions
Pass-by-value or Pass-by-reference • All parameters in Python are pass-by-reference, but some appear to act as pass-by-value because of the difference between mutable and immutable objects • String, tuples and numbers are immutable, altering them will create a new instance • Lists and dictionaries are mutable, altering them will also change the original object
Type Checking: Dynamic and Strong • Python has dynamic type checking, which means all types are resolved at run-time rather than at compile time • Python uses strong type checking, ensuring type errors are thrown for mismatches in type • As of version 3, Python no longer supports type coercion • Static type inference is not possible in Python
Object-orientedness • Python supports multiple inheritance • Python utilizes static variable and static method inheritance • Super(), in version 3 of Python, is invoked dynamically and calls the superclass method of the same name
Conclusion • Python is an easy-to-use, robust programming language that is freely available • Python’s objects and functions are very versatile • Python is a very high-level object-oriented language • Python is awesome!