New version page

MIT 6 893 - What's New in Python?

Documents in this Course
Toolkits

Toolkits

16 pages

Cricket

Cricket

29 pages

Quiz 1

Quiz 1

8 pages

Security

Security

28 pages

Load more

This preview shows page 1-2-3-22-23-24-44-45-46 out of 46 pages.

View Full Document
View Full Document

End of preview. Want to read all 46 pages?

Upload your study docs or become a GradeBuddy member to access this document.

View Full Document
Unformatted text preview:

Sept. 2003 © 1999-2003 Guido van Rossum1What's New in Python?"Not your usual list of new features"Stanford CSL Colloquium, October 29, 2003;BayPiggies, November 13, 2003Guido van RossumElemental [email protected]@elementalsecurity.comSept. 2003 © 1999-2003 Guido van Rossum2Sept. 2003 © 1999-2003 Guido van Rossum3Talk Overview• About me• About Python• Case study 1: iterators and generators• Case study 2: new classes and descriptors• Question TimeSept. 2003 © 1999-2003 Guido van Rossum4About Me• Age 4: first Lego kit• Age 10: first electronics kit (with two transistors)• Age 18: first computer program (on punched cards)• Age 21: first girlfriend :-)• 1982: "drs" math degree; joined CWI in Amsterdam• 1987: first worldwide open source release• 1989: started work on Python in spare time• 1995: moved to Virginia, USA to join CNRI• 2000: got married• 2001: became a father• 2003: moved to California to join Elemental SecuritySept. 2003 © 1999-2003 Guido van Rossum5About Elemental Security• Enterprise security software• Early stage startup in stealth mode• Using lots of Python• We're hiring! • See http://www.elementalsecurity.comSept. 2003 © 1999-2003 Guido van Rossum6Sept. 2003 © 1999-2003 Guido van Rossum7About Python"The promotional package"Sept. 2003 © 1999-2003 Guido van Rossum8Executive Summary• Dynamically typed object-oriented language• Python programs look like executable pseudo-code• Supports multiple paradigms:– procedural, object-oriented, some functional• Extensible in C, C++, Fortran, ...• Used by:– Google, ILM, NASA, Red Hat, RealNetworks, ...• Written in portable ANSI C (mostly...)• Runs on:– Unix, Windows, Mac, Palm, VxWorks, PlayStation 2, ...• Jython: Java version, translates to Java byte codeSept. 2003 © 1999-2003 Guido van Rossum9Why Use Python?• Dynamic languages are more productive• Python code is more readable• Python code is more maintainable• Python has fast built-in very high-level data types• Developer time is more expensive than CPU timeWhen Should You Not Use Python (Yet)?• Things like packet filters, MP3 codecs, etc.• Instead, write in C/C++ and wrap Python around itSept. 2003 © 1999-2003 Guido van Rossum10Example Function• def gcd(a, b):"Greatest common divisor of two integers"while b != 0:a, b = b, a%breturn a• Note:– no declarations– indentation+colon for statement grouping– doc string part of function syntax– parallel assignment (to swap a and b: "a, b = b, a")Sept. 2003 © 1999-2003 Guido van Rossum11Sample Use Areas• Server-side web programming (CGI, app servers)• Client-side web programming (HTML, HTTP, ...)• XML processing (including XML-RPC and SOAP)• Databases (Oracle, MySQL, PostgreSQL, ODBC, ...)• GUI programming (Qt, GTK+, Tcl/Tk, wxPython, ...)• Scientific/numeric computing (e.g. LLNL)• Testing (popular area for Jython)• Scripting Unix and Windows• Rapid prototyping (e.g. at Google)• Programming education (e.g. Oxford physics)– from middle school to collegeSept. 2003 © 1999-2003 Guido van Rossum12Standard Library• File I/O, socket I/O, web protocols (HTTP, CGI, ...)• XML, HTML parsing (DOM, SAX, Expat)• Regular expressions (using standard Perl re syntax)• compression (gzip/zlib, bz2), archiving (zip, tar)• math, random, checksums, algorithms, data types• date/time/calendar• threads, signals, low-level system calls• Python introspection, profiling, debugging, testing• email handling• and much, much more!– and 10x more in 3rd party packages (e.g. databases)Sept. 2003 © 1999-2003 Guido van Rossum13Python Community• Python is Open Source software; freely distributable• Code is owned by Python Software Foundation– 501(c)(3) non-profit taking tax-deductible donations– merit-based closed membership (includes sponsors)• License is BSD-ish (no "viral" GPL-like clause)• Users meet:– on Usenet (comp.lang.python)– on IRC (#python at irc.freenode.net)– at local user groups (e.g. www.baypiggies.net)– at conferences (PyCon, EuroPython, OSCON)• Website: www.python.org (downloads, docs, devel)Sept. 2003 © 1999-2003 Guido van Rossum14Python Development Process• Nobody gets paid to work full-time on core Python– Though some folks get paid for some of their time• their employers use Python and need enhancements• The development team never sleeps– For example, for the most recent release:• release manager in Australia• key contributors in UK and Germany• doc manager and Windows expert in Virginia• etc.• Key tools: email, web, CVS, SourceForge trackers– IRC not so popular, due to the time zone differencesSept. 2003 © 1999-2003 Guido van Rossum15Python Enhancement Proposals (PEP)• RFC-like documents proposing new or changed:– language features– library modules– even development processes• Discussion usually starts in python-dev mailing list• Wider community discussion on Usenet• BDFL approval required to go forward– BDFL = "Benevolent Dictator For Life" (that's me :-)– this is not a democracy; let Python have my quirks– we don't want design by committee or majority rule– the PEP system ensures everybody gets input thoughSept. 2003 © 1999-2003 Guido van Rossum16Python Release Philosophy• "Major releases": 2.0 -> 2.1 -> 2.2 -> 2.3– 12-18 month cycle– Focus on new features– Limited backward incompatibilities acceptable• usually requires deprecation in previous major release• "Minor releases": e.g. 2.3 -> 2.3.1 -> 2.3.2 – 3-9 month cycle– Focus on stability; zero backward incompatibilities– One previous major release still maintained• "Super release": 3.0 (a.k.a. Python 3000 :-)– Fix language design bugs (but nothing like Perl 6.0 :-)– Don't hold your breath (I'll need to take a sabbatical)Sept. 2003 © 1999-2003 Guido van Rossum17Case Study 1:Iterators and Generators"Loops generalized and turned inside out"Sept. 2003 © 1999-2003 Guido van Rossum18Evolution of the 'For' Loop• Pascal: for i := 0 to 9 do ...• C: for (i = 0; i < 10; i++) ...• Python: for i in range(10): ...• General form in Python:for <variable> in <sequence>: <statements>• Q: What are the possibilities for <sequence>?Sept. 2003 © 1999-2003 Guido van Rossum19Evolution of Python's Sequence• Oldest: built-in sequence types: list, tuple, string– indexed with integers 0, 1, 2, ... through len(seq)-1• for c in "hello world": print c• Soon


View Full Document
Loading Unlocking...
Login

Join to view What's New in Python? and access 3M+ class-specific study document.

or
We will never post anything without your permission.
Don't have an account?
Sign Up

Join to view What's New in Python? and access 3M+ class-specific study document.

or

By creating an account you agree to our Privacy Policy and Terms Of Use

Already a member?