1. Python – Weniger ist Mehr
oder Mehr mit Weniger
Python Geek Night, Zürich, 16. November 2010
Autor: Dr.-Ing. Mike Müller
E-Mail: mmueller@python-academy.de
2. Entstehung
• 1989/1990 Guido van
Rossum
• Mittelweg zwischen C und
Shell-Scripting
• Ideen von ABC, C, Smalltalk,
Java, (Haskell)
• Langsame Entwicklung in
den 1990ern
• 1999 Version 1.5.2
• Python Software Foundation
3. Open Source
• Python-Lizenz
• Python Software Foundation
• Kern-Entwickler
• Bibliotheks-Entwickler
• Benevolent Diktator for Life - BDFL
• Python Enhancement Proposals
8. Popularität
• relativ leicht erlernbar
• MIT nutzt Python für Computer Science 101
• 1. Semester Python, 2. Semester C++ == 2 Semester
C++
• eingebettet in Blender, Open Office, Inkscape, Gimp
• macht vielen Leuten einfach Spaß
12. Python ist keine
Insel
• Erweitern in C/C++, Java, C#
• SWIG, SIP, Boost.Python
• .NET, COM
• Cython
• Einbetten
• Zugriff auf DLLS / Shared
Libraries
13. Kleben
• Glue Language
• Verbinden von (heterogen Systemen)
• Generieren von Eingabe-Daten
• Starten und Überwachen von Prozessen
• Lesen von Ausgabe-Daten
• Kommunikation über das Netzwerk
• ...
• schnell mit wenigen Code-Zeilen umsetztbar
14. Bibliotheken
• Reichhaltige Standardbibliothek
• Python Package Index ca. 12.000 Pakete
• Wrapper für GUI-Toolkits (wxPython, PyQt, Tkinter etc.)
• Web-Frameworks (Django, Zope, TurboGears, Pylons
etc.)
• Zugriff auf alle gängigen Datenbanken
• Wissenschaftliche Bibliotheken (NumPy, SciPy,
PyTables etc.)
27. Zen
>>> import this
The Zen of Python, by Tim Peters
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 aren't special enough to break the rules.
Although practicality beats purity.
Errors should never pass silently.
Unless explicitly silenced.
28. Zen
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 you're Dutch.
Now is better than never.
Although never is often better than *right* now.
If the implementation is hard to explain, it's a bad idea.
If the implementation is easy to explain, it may be a good idea.
Namespaces are one honking great idea -- let's do more of those!