State of the Python Union PyCon DC, March 26-28, 2003 Guido van Rossum Director of PythonLabs at Zope Corporation

Slides:



Advertisements
Similar presentations
Chapter 4 Loops Liang, Introduction to Java Programming, Eighth Edition, (c) 2011 Pearson Education, Inc. All rights reserved
Advertisements

3rd Annual Plex/2E Worldwide Users Conference 13A Batch Processing in 2E Jeffrey A. Welsh, STAR BASE Consulting, Inc. September 20, 2007.
Copyright © 2008 Pearson Addison-Wesley. All rights reserved. Chapter 16 Unemployment: Search and Efficiency Wages.
Chapter 6 Writing a Program
Copyright © 2003 Pearson Education, Inc. Slide 1.
Chapter 7 Constructors and Other Tools. Copyright © 2006 Pearson Addison-Wesley. All rights reserved. 7-2 Learning Objectives Constructors Definitions.
Copyright © 2003 Pearson Education, Inc. Slide 1 Computer Systems Organization & Architecture Chapters 8-12 John D. Carpinelli.
Copyright © 2003 Pearson Education, Inc. Slide 1.
Managing Conflict and Change
Chapter 1 The Study of Body Function Image PowerPoint
Author: Julia Richards and R. Scott Hawley
1 Copyright © 2013 Elsevier Inc. All rights reserved. Appendix 01.
Right Brain vs. Left Brain. Directions Get a blank sheet of lined paper. Every time you read a description or characteristic that applies to you, write.
® ® Why Design Another Language? Python UK & ACCU Spring Conference Oxford - April 2, 2003 Guido van Rossum Director of PythonLabs at Zope Corporation.
"The State of the Python Union" Python10 - Alexandria, VA - February 7, 2002 Guido van Rossum Director, PythonLabs at Zope Corporation
Why I Invented Python EuroPython – June 27, 2005 Guido van Rossum Elemental Security, Inc.
Python Regrets OSCON, July 25, 2002
EuroPython Keynote June 26, 2002 Guido van Rossum Director of PythonLabs at Zope Corporation
Optional Static Typing Guido van Rossum (with Paul Prescod, Greg Stein, and the types-SIG)
Writing Pseudocode And Making a Flow Chart A Number Guessing Game
10 Copyright © 2005, Oracle. All rights reserved. Reusing Code with Inheritance and Polymorphism.
6 Copyright © 2005, Oracle. All rights reserved. Building Applications with Oracle JDeveloper 10g.
Right vs. Left Brain. This theory of the structure and functions of the mind suggests that the two different sides of the brain control two different.
FACTORING ax2 + bx + c Think “unfoil” Work down, Show all steps.
Programming Language Concepts
Mike Scott University of Texas at Austin
For Translators and Translation Editors Note-Taking presents... by Riccardo Schiaffino CTA 3rd Annual Conference Boulder, May © Riccardo Schiaffino,
Order of Operations Lesson
Chapter 11: Models of Computation
Chair of Software Engineering Einführung in die Programmierung Introduction to Programming Prof. Dr. Bertrand Meyer Exercise Session 5.
The Fun of Programming Chapter 6 How to Write a Financial Contract by Simon Peyton Jones Roger L. Costello July
Accelerated Linear Algebra Libraries James Wynne III NCCS User Assistance.
David Luebke 1 6/7/2014 ITCS 6114 Skip Lists Hashing.
Chapter 24 Lists, Stacks, and Queues
1 Linked Lists III Template Chapter 3. 2 Objectives You will be able to: Write a generic list class as a C++ template. Use the template in a test program.
Modern Programming Languages, 2nd ed.
ABC Technology Project
Lilian Blot Recursion Autumn 2012 TPOP 1. Lilian Blot Recursion Autumn 2012 TPOP 2.
Hash Tables.
By Waqas Over the many years the people have studied software-development approaches to figure out which approaches are quickest, cheapest, most.
© Copyright by Deitel & Associates, Inc. and Pearson Education Inc. All Rights Reserved. 1 Outline 24.1 Test-Driving the Ticket Information Application.
1 University of Utah – School of Computing Computer Science 1021 "Thinking Like a Computer"
Name Convolutional codes Tomashevich Victor. Name- 2 - Introduction Convolutional codes map information to code bits sequentially by convolving a sequence.
Code Correctness, Readability, Maintainability Svetlin Nakov Telerik Corporation
The world leader in serving science TQ ANALYST SOFTWARE Putting your applications on target.
Factor P 16 8(8-5ab) 4(d² + 4) 3rs(2r – s) 15cd(1 + 2cd) 8(4a² + 3b²)
A Third Look At ML 1. Outline More pattern matching Function values and anonymous functions Higher-order functions and currying Predefined higher-order.
© 2012 National Heart Foundation of Australia. Slide 2.
Lilian Blot PART V: FUNCTIONS Core elements Autumn 2013 TPOP 1.
Liang, Introduction to Java Programming, Sixth Edition, (c) 2007 Pearson Education, Inc. All rights reserved Chapter 4 Loops.
Understanding Generalist Practice, 5e, Kirst-Ashman/Hull
Chapter 5 Loops Liang, Introduction to Java Programming, Tenth Edition, (c) 2015 Pearson Education, Inc. All rights reserved.
25 seconds left…...
Chapter 2 Entity-Relationship Data Modeling: Tools and Techniques
Chapter Three Arithmetic Expressions and Assignment Statements
Lilian Blot CORE ELEMENTS SELECTION & FUNCTIONS Lecture 3 Autumn 2014 TPOP 1.
©Brooks/Cole, 2001 Chapter 12 Derived Types-- Enumerated, Structure and Union.
PSSA Preparation.
Chapter 11 Component-Level Design
Chapter 11 Creating Framed Layouts Principles of Web Design, 4 th Edition.
Introduction to Recursion and Recursive Algorithms
Order of Operations And Real Number Operations
Instructor: Shengyu Zhang 1. Content Two problems  Minimum Spanning Tree  Huffman encoding One approach: greedy algorithms 2.
L6:CSC © Dr. Basheer M. Nasef Lecture #6 By Dr. Basheer M. Nasef.
Jonathan Huelman CSC 415 – Programming Languages
Introduction to Python (for C++ programmers). Background Information History – created in December 1989 by Guido van Rossum Interpreted Dynamically-typed.
Intro to Python Programming (Resources) Pamela A. Moore Zenia C. Bahorski Eastern Michigan University March 7, 2012 A language to swear by, not at. 1.
Modules and Decomposition UW CSE 190p Summer 2012 download examples from the calendar.
Python  Monty or Snake?. Monty?  Spam, spam, spam and eggs  Dead parrots  Eric Idle, John Cleese, Michael Palin, etc.
Presentation transcript:

State of the Python Union PyCon DC, March 26-28, 2003 Guido van Rossum Director of PythonLabs at Zope Corporation

Slide 2Copyright 2002 Zope Corporation. All rights reserved.

Slide 3Copyright 2002 Zope Corporation. All rights reserved. Python.Org HTTP Statistics Feb M requests from 288K hosts (358K hits for "/") 50K downloads of Python (65% Windows) May M requests from 257K hosts (291K hits for "/") 52K downloads of Python (70% Windows) Feb M requests from 164K hosts (212K hits for "/") 23K downloads of Python 2.0 (70% Windows)

Slide 4Copyright 2002 Zope Corporation. All rights reserved. Let's start the PR offensive Python is more visible than ever –But still seen as a small player –Hard to move into enterprises –Hard to conquer education PSF can accept donations now –How to use the money: PR or development? –I'd rather spend money on "real" stuff –But we need to bootstrap the donations some PR necessary to get our name known some money necessary to write grant proposals

Slide 5Copyright 2002 Zope Corporation. All rights reserved. Controversy of the year Yearly recap of a recent flame war This year's topic: –adding an if-then-else expression maybe not a flamewar but definitely controversial :-) –don't call it "ternary expression" that's descriptive of form, not function

Slide 6Copyright 2002 Zope Corporation. All rights reserved. Forces at work Pro: –expressiveness –avoids bug in "c and x or y" (what if x is false) Con: –more to learn –encourages hard-to-read code Arguments both Pro and Con strongly felt! –even more strongly argued :-)

Slide 7Copyright 2002 Zope Corporation. All rights reserved. Two separate decisions Whether to add if-then-else expression at all Which syntax to use Are these choices really independent?

Slide 8Copyright 2002 Zope Corporation. All rights reserved. And the winner is... Four candidates got most of the votes: –235. (if C: x else: y) –206. C ? x : y –168. if C then x else y –161. x if C else y Voting procedure was complicated –Total votes received: 436 ranking + 82 reject-all = 518 total –Ranked votes (up to 3 rankings per vote received): w/o reject-all: 851 accept reject = 1303 total with reject-all: 851 accept reject = 1549 total –each of 82 reject-all counted as 3 ranked rejects

Slide 9Copyright 2002 Zope Corporation. All rights reserved. Condorcet voting Alternative elections (under 100 votes) Also re-interpreted official votes Ranking of official votes: –1. no change –2. (if C: x else: y) –3. C ? x : y –4. x if C else y –5. if C then x else y Alternative election had different set of choices; no change wins there, too

Slide 10Copyright 2002 Zope Corporation. All rights reserved. So what will I do? No more voting! I'll to decide between: –no change –(if C: x else: y) If accepted: –I'll extend the syntax to use elif, e.g.: (if C1: x1 elif C2: x2 elif C3: x3 else: y) –It may be possible to omit the parentheses in certain syntactical positions, e.g.: min = lambda a, b: if a < b: a else: b but is this really clearer?

Slide 11Copyright 2002 Zope Corporation. All rights reserved. The Zen of Python - part 1 (Formulated by Tim Peters) 1.Beautiful is better than ugly. 2.Explicit is better than implicit. 3.Simple is better than complex. 4.Complex is better than complicated. 5.Flat is better than nested. 6.Sparse is better than dense. 7.Readability counts. 8.Special cases aren't special enough to break the rules. 9.Although practicality beats purity. 10.Errors should never pass silently. 11.Unless explicitly silenced.

Slide 12Copyright 2002 Zope Corporation. All rights reserved. The Zen of Python - part 2 12.In the face of ambiguity, refuse the temptation to guess. 13.There should be one and preferably only one obvious way to do it. 14.Although that way may not be obvious at first unless you're Dutch. 15.Now is better than never. 16.Although never is often better than right now. 17.If the implementation is hard to explain, it's a bad idea. 18.If the implementation is easy to explain, it may be a good idea. 19.Namespaces are one honking great idea let's do more of those! (left for me to fill)

Slide 13Copyright 2002 Zope Corporation. All rights reserved. 1. Beautiful is better than ugly But which is more beautiful? –if c: x else: y –if c then x else y –x if c else y –c ? x : y

Slide 14Copyright 2002 Zope Corporation. All rights reserved. 2. Explicit is better than implicit Except when it isn't: – # 2 converted to float But see float division issue for some nastiness –"abc" + u"def" # "abc" is converted to unicode Not everyone likes this one Trend towards implicitness: –for key in dict:... –if substring in string:...

Slide 15Copyright 2002 Zope Corporation. All rights reserved. 3. Simple is better than complex Should this always favor less typing? Sometimes yes: –"if key in dict" vs. "if dict.has_key(key)" –"sub in s" vs. "s.find(sub) >= 0" Sometimes no: –return (if x > 0: x else: None) vs. if x > 0: return x else: return None

Slide 16Copyright 2002 Zope Corporation. All rights reserved. 4. Complex is better than complicated Some things are simply complex –And trying to simplify them too much makes them complicated! But sometimes complicated is the only way we know how to do something –E.g. when following a complicated external standard go fight the standard, but in the mean time use it

Slide 17Copyright 2002 Zope Corporation. All rights reserved. 5. Flat is better than nested Hence the flat standard library namespace Why is this so? –Distaste for "extreme structure" It's okay to add more nesting later As a system grows, all dimensions grow: –package nesting depth –modules per package –classes per module –methods per class –lines per method –characters per line –number of kinds of files (extensions)

Slide 18Copyright 2002 Zope Corporation. All rights reserved. 6. Sparse is better than dense When a line gets too long: store a subexpression in a variable rather than using line continuation features –Don't worry about speed local variables are as fast as the stack! But a list comprehension can be very clear

Slide 19Copyright 2002 Zope Corporation. All rights reserved. 7. Readability counts When are you in more of a hurry: –When reading code? e.g. trying to find a bug that crashes a live server –Or when writing code? e.g. trying to meet an arbitrary deadline set by marketroids When writing code, think of your readers!

Slide 20Copyright 2002 Zope Corporation. All rights reserved. 8. Special cases aren't special enough to break the rules For example, __future__ imports

Slide 21Copyright 2002 Zope Corporation. All rights reserved. 9. Although practicality beats purity For example, __future__ imports

Slide 22Copyright 2002 Zope Corporation. All rights reserved. 10. Errors should never pass silently But the definition of error is debatable –E.g. "abc" + u"" vs. "\xff" + u""

Slide 23Copyright 2002 Zope Corporation. All rights reserved. 11. Unless explicitly silenced E.g. the encode() and decode() methods –default behavior is to raise exception –optional argument to ignore errors Watch out for silencing too much! –unqualified except usually evil

Slide 24Copyright 2002 Zope Corporation. All rights reserved. 12. In the face of ambiguity, refuse the temptation to guess This applies to 1+"2" (3 or "12"???) Also explains requirement for "self.ivar" Really a rehash of "explicit vs. implicit"

Slide 25Copyright 2002 Zope Corporation. All rights reserved. 13. There should be one and preferably only one obvious way to do it Not quite TOOWTDI Is violated a lot Explains why I don't like xrange(), lambda Introducing a better way often leaves the old way as an entrenched idiom for years Which way is obvious isn't always obvious Example: __new__ vs. __init__

Slide 26Copyright 2002 Zope Corporation. All rights reserved. 14. Although that way may not be obvious at first unless you're Dutch IOW the BDFL decides :-) It's a matter of user education Example: lists vs. tuples –this is often misrepresented as "tuple are readonly lists", which is wrong –use cases are quite different –but... tuples also usable as readonly lists

Slide 27Copyright 2002 Zope Corporation. All rights reserved. 15. Now is better than never Some things are so important that it is okay to add a provisional feature first Example: new-style classes introduced –static & class methods –properties –slots –super without new syntax

Slide 28Copyright 2002 Zope Corporation. All rights reserved. 16. Although never is often better than right now Always count till 10 before deciding –For important decisions, count till 100 :-) Still counting for if-then-else If I can't find an acceptable way to spell something, I'd rather leave it out –when in doubt, don't pass

Slide 29Copyright 2002 Zope Corporation. All rights reserved. 17. If the implementation is hard to explain, it's a bad idea Very important to me! –If I can't see how to implement something (efficiently) I can't get myself to add it –"Constructive math" ideal Implementation usually needs to be documented anyway –Because it explains limitations, and users will run into those; better warn them –This applies to the general implementation strategy, not to every little detail

Slide 30Copyright 2002 Zope Corporation. All rights reserved. 18. If the implementation is easy to explain, it may be a good idea Implementation sometimes suggests a generalization of a feature –This is why I like straightforward, understandable implementations Sometimes an implementation is over- specified and using an implementation hack would preclude future improvements –But the stable sort was too good to pass by

Slide 31Copyright 2002 Zope Corporation. All rights reserved. 19. Namespaces are one honking great idea let's do more of those! Also relates to the usefulness of dictionaries Somewhat contradicts "flat vs. nested"

Slide 32Copyright 2002 Zope Corporation. All rights reserved Raymond Hettinger suggested: –Iterators unified access to containers let's fine more of those. –Substitutability simplifies development so shelves have a full dictionary interface but tuples won't sprout a count method because lists differ in intent. –Deprecation comes at a price but cruft has a cost of its own. –Holistic refactoring beats piecemeal optimization. –Comment generously, the best modules are an education to read. (*) –Be kind on the Usenet; some posters are only eleven.

Slide 33Copyright 2002 Zope Corporation. All rights reserved. Where I'd like to take Python Reduce feature duplication –Examples: string module vs. string methods xrange() vs. range() classic vs. new-style classes int vs. long 8-bit vs. unicode strings map/filter vs. list comprehensions lambda vs. def Change rules slightly to benefit code analysis Wanna hear my "Python Regrets" talk?

Slide 34Copyright 2002 Zope Corporation. All rights reserved. And about the implementation Short term: –speed hacks call_attr obj_attr –fix rexec? Long term: –native code compilation –Psycho? –PyPy? –Parrot?