Jordan Miller and Lauren WinklemanCS 311Fall 2011
Guido Van Rossum implemented/created Python in 1991. He wanted to create a language anyone can use. The point was to make it an easy language to learn.Rossum is known as Python’s Principal AuthorPythonwas awarded the TIOBE Programming Language of the Yeartwice (2007, 2010)
‘Pythonistas’ (advocates of Python) believe that Python is better than C or C++ and should be used for all programming work, not just scriptingUses dynamic typing with the feature of “late binding”Uses reference counting and a cycle detecting garbage collectorCan be used as an extension language for existing modules and applications that need a programmable interfaceUsed on windowsmacintoshandunixplatforms
Domain and Implementation
Often used as a scripting language for web applications although this was not its originalpurposeHasbeen used in Artificial Intelligence (AI)Can be used for CGIPython was implemented in CImplementations can compile not only byte codes but can turn Python code into machine code
Python’s Philosophy: “There should be one and preferably only one way to do it.”Clean and clutter free syntax and in plain EnglishMulti-paradigm programming language so programmers can use different programming styles when writing (functional, object-oriented, imperative)Thereare no semicolons at the end of Python source code statements. A new line means a new statement. If you need a very long line, you can use the backslash character for continuation, e.g.x = y + \z
Python’s Goal: “To reduce confusion by having a syntax that is understandable in plain English”Includes basic textmanipulation facilities of Awk andPerl, making iteasier toreadFewer syntaxrulesSimilar format forif/for/whilestatements as otherprogramsA+ for readability. This is considered one of its greatest advantages.
Python is implemented in C and relies on well understood, portable C librariesPython.orgstates that in applications that started out as pure C++ with Python being added as an extension language, a higher % of code written in Python = an increase in overall performance, functionality andreliabilityof the application.Creates robust applications
Cost of interactivity is high but it speeds up the execution timeBecause it is so easy to learn and write, the cost is lower in the training and development stages and interactive mode makes testing fast and easy. “When in doubt, try it out!”
Easy to learn, even non experienced programmers can use it. Ex: spacing and tabbing instead of extra syntax (Don’t have to learn new rules)Can be used extensively to benefit other programming languagesInteractive modeDevelopment process proceeds 5 to 10 times faster than in other languages such as Java or C++Lessmemory used because a single container hold multiple data types and each type doesn’t require its own function
Python interprets the code during runtime instead of compile time causing a slower execution. Runs 1 to 5 times slower than Java or C++Official documentation is scarce because the language evolves so often.New modules are not always a part of the standard release or standard library and must be imported into the project.
Interactive mode allows Python to function as a quick calculator. Ex:What is 5% above 88.88?%python>>> 1.05*88.8893.323999999999998
If statement:if x < 3:print “hello”For statement:for i in range(10):print iWhile statement:while x < 8:x = x + 1
name =raw_input(‘Please enter your \ name:’)course =raw_input(‘Enter the course \ number:’)num=int(course)ifnum== 311:print name, “ is in this class.”else:print name, “ is not in this class.”
Who’s Using Python?
GoogleGaming industriesBattlefield 2 – score keeping and team balancingStar Trek Bridge Commander – mission scripting and many other featuresYahoo MapsLinux Weekly News
A Quick, Painless Tutorial on the PythonLanguage by NormanMatloffpython.org andwiki.python.orgugweb.cs.ualberta.ca