SlideShare ist ein Scribd-Unternehmen logo
1 von 29
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
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
Open Source
• Python-Lizenz
• Python Software Foundation
• Kern-Entwickler
• Bibliotheks-Entwickler
• Benevolent Diktator for Life - BDFL
• Python Enhancement Proposals
Hauptmerkmale
• Einfach
• Konsistent
• Lesbar
Anwender
• Open Source
• Google (Kern-Entwickler)
• YouTube
• Deutsche Luft- und
Raumfahrt
• NASA
• Walt Disney
• Rackspace
• ...
Anwender
• Programmieranfänger
• Softwareentwickler
• Tester
• Systemadminstratoren
• Wissenschaftler und Ingenieure
• Python skaliert
• leichter Einstieg
• viele fortgeschrittene Möglichkeiten
(Meta-Programmierung)
Popularität
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ß
Betriebssysteme
• Windows
• Linux
• Mac
• Main-Frames
• Mobile Geräte
• DOS
Technologie
• Interpreter
• Plattformunabhängiger Bytecode
• Fast alles zur Laufzeit
• Einfache Meta-Programmierung
Implementierungen
• CPython == Standard Python
• Jython in Java
• IronPython in C#
• PyPy in Python
• Stackless
• Mehr
Python ist keine
Insel
• Erweitern in C/C++, Java, C#
• SWIG, SIP, Boost.Python
• .NET, COM
• Cython
• Einbetten
• Zugriff auf DLLS / Shared
Libraries
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
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.)
Paradigmen
• Prozedural
• Objekt-orientiert
• Funktional
Syntax
• Einrückungen zählen
• Compiler "sieht" Quelltext genauso wie Programmierer
• Einrückung nach Doppelpunkt
• Ausrückung zeigt Endes eines Blockes an
• Ausführbarer Pseudocode
• Elegant
Interaktiver Modus
>>> 1 + 1
2
>>> def add(x, y):
... return x + y
...
>>> add(12, 14)
26
Scripte
# add.py
def add(x, y):
return x + y
print add(12, 14)
Ausgabe:
26
Datenstrukturen
• Eingebaut
• Fester Bestandteil der Sprache
• Listen
• Dictionarys
Listen
>>> my_list = [10, 20, 30, 40, 50]
>>> my_list[0]
10
>>> my_list[1]
20
>>> my_list[-1]
50
>>> my_list[1:3]
[20, 30]
>>> my_list[::2]
[10, 30, 50]
Listen
>>> my_list.append(60)
>>> my_list
[10, 20, 30, 40, 50, 60]
>>> my_list.append([1, 2, 3])
>>> my_list
[10, 20, 30, 40, 50, 60, [1, 2, 3]]
>>> my_list[-1] = 70
>>> my_list
[10, 20, 30, 40, 50, 60, 70]
List Comprehension
• von Haskell abgeschaut
>>> [item * 2 for item in my_list]
[20, 40, 60, 80, 100, 120, 140]
>>> [item * 2 for item in my_list if item > 40]
[100, 120, 140]
>>>
Dictionarys
• Hash-Tabellen
• Assoziative Arrays
>>> my_dict = {'a': 100, 'b': 200, 'c': 300}
>>> my_dict
{'a': 100, 'c': 300, 'b': 200}
>>> my_dict['a']
100
Dictionarys
>>> my_dict['x']
Traceback (most recent call last):
File "<interactive input>", line 1, in <module>
KeyError: 'x'
>>> my_dict['x'] = 3
>>> my_dict
{'a': 100, 'x': 3, 'c': 300, 'b': 200}
>>> my_dict['a'] = -1
>>> my_dict
{'a': -1, 'x': 3, 'c': 300, 'b': 200}
Objektorientierung
>>> class MyClass(object):
... def __init__(self, attr1, attr2):
... self.attr1 = attr1
... self.attr2 = attr2
... def get_sum(self):
... return self.attr1 + self.attr2
...
>>> my_instance = MyClass(10, 12)
>>> my_instance.get_sum()
22
Objektorientierung
>>> my_instance.attr1
10
>>> my_instance.attr2
12
>>> my_instance.attr1 = 100
>>> my_instance.attr1
100
>>> my_instance.get_sum()
112
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.
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!
Fragen?

Weitere ähnliche Inhalte

Was ist angesagt?

Arbeiten Mit Dateien Linux
Arbeiten Mit Dateien LinuxArbeiten Mit Dateien Linux
Arbeiten Mit Dateien Linuxheiko.vogl
 
OSMC 2018 | Katzeninhalt mit ein wenig Einhornmagie by Carsten Koebke
OSMC 2018 | Katzeninhalt mit ein wenig Einhornmagie by Carsten KoebkeOSMC 2018 | Katzeninhalt mit ein wenig Einhornmagie by Carsten Koebke
OSMC 2018 | Katzeninhalt mit ein wenig Einhornmagie by Carsten KoebkeNETWAYS
 
Neuerungen in TypoScript in TYPO3 Version 4.7
Neuerungen in TypoScript in TYPO3 Version 4.7Neuerungen in TypoScript in TYPO3 Version 4.7
Neuerungen in TypoScript in TYPO3 Version 4.7Steffen Ritter
 
Einführung in die funktionale Programmierung mit Clojure
Einführung in die funktionale Programmierung mit ClojureEinführung in die funktionale Programmierung mit Clojure
Einführung in die funktionale Programmierung mit ClojureSascha Koch
 
Multithreading in c# mit tpl
Multithreading in c# mit tplMultithreading in c# mit tpl
Multithreading in c# mit tplDavidT27
 
SysDB – System DataBase — Ein Datenaggregator für System-Informationen
SysDB – System DataBase — Ein Datenaggregator für System-InformationenSysDB – System DataBase — Ein Datenaggregator für System-Informationen
SysDB – System DataBase — Ein Datenaggregator für System-InformationenSysDB Project
 
Socket Programmierung mit IPv6
Socket Programmierung mit IPv6Socket Programmierung mit IPv6
Socket Programmierung mit IPv6Christian Kauhaus
 

Was ist angesagt? (9)

Effiziente Programme
Effiziente ProgrammeEffiziente Programme
Effiziente Programme
 
Arbeiten Mit Dateien Linux
Arbeiten Mit Dateien LinuxArbeiten Mit Dateien Linux
Arbeiten Mit Dateien Linux
 
OSMC 2018 | Katzeninhalt mit ein wenig Einhornmagie by Carsten Koebke
OSMC 2018 | Katzeninhalt mit ein wenig Einhornmagie by Carsten KoebkeOSMC 2018 | Katzeninhalt mit ein wenig Einhornmagie by Carsten Koebke
OSMC 2018 | Katzeninhalt mit ein wenig Einhornmagie by Carsten Koebke
 
Hooks
HooksHooks
Hooks
 
Neuerungen in TypoScript in TYPO3 Version 4.7
Neuerungen in TypoScript in TYPO3 Version 4.7Neuerungen in TypoScript in TYPO3 Version 4.7
Neuerungen in TypoScript in TYPO3 Version 4.7
 
Einführung in die funktionale Programmierung mit Clojure
Einführung in die funktionale Programmierung mit ClojureEinführung in die funktionale Programmierung mit Clojure
Einführung in die funktionale Programmierung mit Clojure
 
Multithreading in c# mit tpl
Multithreading in c# mit tplMultithreading in c# mit tpl
Multithreading in c# mit tpl
 
SysDB – System DataBase — Ein Datenaggregator für System-Informationen
SysDB – System DataBase — Ein Datenaggregator für System-InformationenSysDB – System DataBase — Ein Datenaggregator für System-Informationen
SysDB – System DataBase — Ein Datenaggregator für System-Informationen
 
Socket Programmierung mit IPv6
Socket Programmierung mit IPv6Socket Programmierung mit IPv6
Socket Programmierung mit IPv6
 

Ähnlich wie Python Mike Müller

Warum Python?
Warum Python?Warum Python?
Warum Python?tharwan
 
Kuck mal, Node.js! Einstieg für .NET Entwickler mit Visual Studio Code und Ty...
Kuck mal, Node.js! Einstieg für .NET Entwickler mit Visual Studio Code und Ty...Kuck mal, Node.js! Einstieg für .NET Entwickler mit Visual Studio Code und Ty...
Kuck mal, Node.js! Einstieg für .NET Entwickler mit Visual Studio Code und Ty...Gregor Biswanger
 
Sicherheitsfunktionen In Aktuellen Betriebssystemen Talk
Sicherheitsfunktionen In Aktuellen Betriebssystemen TalkSicherheitsfunktionen In Aktuellen Betriebssystemen Talk
Sicherheitsfunktionen In Aktuellen Betriebssystemen TalkUdo Ornik
 
Fanstatic pycon.de 2012
Fanstatic pycon.de 2012Fanstatic pycon.de 2012
Fanstatic pycon.de 2012Daniel Havlik
 
Docker und Kubernetes Patterns & Anti-Patterns
Docker und Kubernetes Patterns & Anti-PatternsDocker und Kubernetes Patterns & Anti-Patterns
Docker und Kubernetes Patterns & Anti-PatternsQAware GmbH
 
Docker und Kubernetes Patterns & Anti-Patterns
Docker und Kubernetes Patterns & Anti-PatternsDocker und Kubernetes Patterns & Anti-Patterns
Docker und Kubernetes Patterns & Anti-PatternsJosef Adersberger
 
The pain of choice - Important libs for C# developers
The pain of choice - Important libs for C# developersThe pain of choice - Important libs for C# developers
The pain of choice - Important libs for C# developersFDeitelhoff
 
Tech-Talk: Python vs. Ruby
Tech-Talk: Python vs. RubyTech-Talk: Python vs. Ruby
Tech-Talk: Python vs. Rubyschlauch
 
Infrastructure as Code - BaselOne 17
Infrastructure as Code - BaselOne 17Infrastructure as Code - BaselOne 17
Infrastructure as Code - BaselOne 17remigius-stalder
 
Betriebsysteme: zwei wichtige Konzepte aus der Praxis
Betriebsysteme: zwei wichtige Konzepte aus der PraxisBetriebsysteme: zwei wichtige Konzepte aus der Praxis
Betriebsysteme: zwei wichtige Konzepte aus der PraxisBrigitte Jellinek
 
Icinga mit Puppet - Hamburg 2013
Icinga mit Puppet  - Hamburg 2013Icinga mit Puppet  - Hamburg 2013
Icinga mit Puppet - Hamburg 2013NETWAYS
 
Dart (Teil II der Tour de Dart)
Dart (Teil II der Tour de Dart)Dart (Teil II der Tour de Dart)
Dart (Teil II der Tour de Dart)Nane Kratzke
 
mm_forum 2.0
mm_forum 2.0mm_forum 2.0
mm_forum 2.0mhelmich
 
Azure Notebooks
Azure NotebooksAzure Notebooks
Azure NotebooksTEitelberg
 
Back to Basics – Webinar 2: Ihre erste MongoDB-Anwendung
Back to Basics – Webinar 2: Ihre erste MongoDB-AnwendungBack to Basics – Webinar 2: Ihre erste MongoDB-Anwendung
Back to Basics – Webinar 2: Ihre erste MongoDB-AnwendungMongoDB
 

Ähnlich wie Python Mike Müller (20)

Windows Powershell
Windows PowershellWindows Powershell
Windows Powershell
 
Warum Python?
Warum Python?Warum Python?
Warum Python?
 
Kuck mal, Node.js! Einstieg für .NET Entwickler mit Visual Studio Code und Ty...
Kuck mal, Node.js! Einstieg für .NET Entwickler mit Visual Studio Code und Ty...Kuck mal, Node.js! Einstieg für .NET Entwickler mit Visual Studio Code und Ty...
Kuck mal, Node.js! Einstieg für .NET Entwickler mit Visual Studio Code und Ty...
 
openHAB @ rheinJUG Düsseldorf
openHAB @ rheinJUG DüsseldorfopenHAB @ rheinJUG Düsseldorf
openHAB @ rheinJUG Düsseldorf
 
Sicherheitsfunktionen In Aktuellen Betriebssystemen Talk
Sicherheitsfunktionen In Aktuellen Betriebssystemen TalkSicherheitsfunktionen In Aktuellen Betriebssystemen Talk
Sicherheitsfunktionen In Aktuellen Betriebssystemen Talk
 
Fanstatic pycon.de 2012
Fanstatic pycon.de 2012Fanstatic pycon.de 2012
Fanstatic pycon.de 2012
 
Docker und Kubernetes Patterns & Anti-Patterns
Docker und Kubernetes Patterns & Anti-PatternsDocker und Kubernetes Patterns & Anti-Patterns
Docker und Kubernetes Patterns & Anti-Patterns
 
Docker und Kubernetes Patterns & Anti-Patterns
Docker und Kubernetes Patterns & Anti-PatternsDocker und Kubernetes Patterns & Anti-Patterns
Docker und Kubernetes Patterns & Anti-Patterns
 
The pain of choice - Important libs for C# developers
The pain of choice - Important libs for C# developersThe pain of choice - Important libs for C# developers
The pain of choice - Important libs for C# developers
 
Tech-Talk: Python vs. Ruby
Tech-Talk: Python vs. RubyTech-Talk: Python vs. Ruby
Tech-Talk: Python vs. Ruby
 
JavaScript Performance
JavaScript PerformanceJavaScript Performance
JavaScript Performance
 
Infrastructure as Code - BaselOne 17
Infrastructure as Code - BaselOne 17Infrastructure as Code - BaselOne 17
Infrastructure as Code - BaselOne 17
 
Node.js Security
Node.js SecurityNode.js Security
Node.js Security
 
Betriebsysteme: zwei wichtige Konzepte aus der Praxis
Betriebsysteme: zwei wichtige Konzepte aus der PraxisBetriebsysteme: zwei wichtige Konzepte aus der Praxis
Betriebsysteme: zwei wichtige Konzepte aus der Praxis
 
Icinga mit Puppet - Hamburg 2013
Icinga mit Puppet  - Hamburg 2013Icinga mit Puppet  - Hamburg 2013
Icinga mit Puppet - Hamburg 2013
 
Dart (Teil II der Tour de Dart)
Dart (Teil II der Tour de Dart)Dart (Teil II der Tour de Dart)
Dart (Teil II der Tour de Dart)
 
mm_forum 2.0
mm_forum 2.0mm_forum 2.0
mm_forum 2.0
 
PLUX.NET – SOFTWAREKOMPOSITION DURCH PLUG & PLAY
PLUX.NET – SOFTWAREKOMPOSITION DURCH PLUG & PLAYPLUX.NET – SOFTWAREKOMPOSITION DURCH PLUG & PLAY
PLUX.NET – SOFTWAREKOMPOSITION DURCH PLUG & PLAY
 
Azure Notebooks
Azure NotebooksAzure Notebooks
Azure Notebooks
 
Back to Basics – Webinar 2: Ihre erste MongoDB-Anwendung
Back to Basics – Webinar 2: Ihre erste MongoDB-AnwendungBack to Basics – Webinar 2: Ihre erste MongoDB-Anwendung
Back to Basics – Webinar 2: Ihre erste MongoDB-Anwendung
 

Mehr von Aberla

Mobile Banking 2011: Clairmail
Mobile Banking 2011: ClairmailMobile Banking 2011: Clairmail
Mobile Banking 2011: ClairmailAberla
 
Mobile Banking 2011: DAB
Mobile Banking 2011: DABMobile Banking 2011: DAB
Mobile Banking 2011: DABAberla
 
Mobile Banking 2011: Sparkasse
Mobile Banking 2011: SparkasseMobile Banking 2011: Sparkasse
Mobile Banking 2011: SparkasseAberla
 
Mobile Banking 2011: Credit Suisse
Mobile Banking 2011: Credit SuisseMobile Banking 2011: Credit Suisse
Mobile Banking 2011: Credit SuisseAberla
 
Mobile Banking 2011: Danske Bank
Mobile Banking 2011: Danske BankMobile Banking 2011: Danske Bank
Mobile Banking 2011: Danske BankAberla
 
Mobile Banking 2011: Postfinance
Mobile Banking 2011: PostfinanceMobile Banking 2011: Postfinance
Mobile Banking 2011: PostfinanceAberla
 
ESeconf2011 - Haug Thomas: "Sauberer Code mit Metriken"
ESeconf2011 - Haug Thomas: "Sauberer Code mit Metriken"ESeconf2011 - Haug Thomas: "Sauberer Code mit Metriken"
ESeconf2011 - Haug Thomas: "Sauberer Code mit Metriken"Aberla
 
ESEconf2011 - Cruywagen Leon: "Cool ways to work smarter in the cloud"
ESEconf2011 - Cruywagen Leon: "Cool ways to work smarter in the cloud"ESEconf2011 - Cruywagen Leon: "Cool ways to work smarter in the cloud"
ESEconf2011 - Cruywagen Leon: "Cool ways to work smarter in the cloud"Aberla
 
ESEconf2011 - Wichmann Klaus-Peter: "Kennen Sie die Leistungsfähigkeit Ihres ...
ESEconf2011 - Wichmann Klaus-Peter: "Kennen Sie die Leistungsfähigkeit Ihres ...ESEconf2011 - Wichmann Klaus-Peter: "Kennen Sie die Leistungsfähigkeit Ihres ...
ESEconf2011 - Wichmann Klaus-Peter: "Kennen Sie die Leistungsfähigkeit Ihres ...Aberla
 
ESEconf2011 - Hanin Makram: "Embedding Performance into Continuous Integratio...
ESEconf2011 - Hanin Makram: "Embedding Performance into Continuous Integratio...ESEconf2011 - Hanin Makram: "Embedding Performance into Continuous Integratio...
ESEconf2011 - Hanin Makram: "Embedding Performance into Continuous Integratio...Aberla
 
ESEconf2011 - Lorenz Oliver: "'Agil heisst nicht beliebit' - Scrum als wirksa...
ESEconf2011 - Lorenz Oliver: "'Agil heisst nicht beliebit' - Scrum als wirksa...ESEconf2011 - Lorenz Oliver: "'Agil heisst nicht beliebit' - Scrum als wirksa...
ESEconf2011 - Lorenz Oliver: "'Agil heisst nicht beliebit' - Scrum als wirksa...Aberla
 
ESEconf2011 - Schilling Rüdiger: "Generative Konzepte für den Plattform-Zoo -...
ESEconf2011 - Schilling Rüdiger: "Generative Konzepte für den Plattform-Zoo -...ESEconf2011 - Schilling Rüdiger: "Generative Konzepte für den Plattform-Zoo -...
ESEconf2011 - Schilling Rüdiger: "Generative Konzepte für den Plattform-Zoo -...Aberla
 
ESEconf2011 - Freixa Vidal Roger: "Oracle's Java Strategy"
ESEconf2011 - Freixa Vidal Roger: "Oracle's Java Strategy"ESEconf2011 - Freixa Vidal Roger: "Oracle's Java Strategy"
ESEconf2011 - Freixa Vidal Roger: "Oracle's Java Strategy"Aberla
 
ESEconf2011 - Westphal Ralf: "Slice me nice - Produktiv, schnell, zufrieden"
ESEconf2011 - Westphal Ralf: "Slice me nice - Produktiv, schnell, zufrieden"ESEconf2011 - Westphal Ralf: "Slice me nice - Produktiv, schnell, zufrieden"
ESEconf2011 - Westphal Ralf: "Slice me nice - Produktiv, schnell, zufrieden"Aberla
 
ESEconf2011 - Caine Matthew: "Creating an Environment of Teamwork, Quality, I...
ESEconf2011 - Caine Matthew: "Creating an Environment of Teamwork, Quality, I...ESEconf2011 - Caine Matthew: "Creating an Environment of Teamwork, Quality, I...
ESEconf2011 - Caine Matthew: "Creating an Environment of Teamwork, Quality, I...Aberla
 
ESEconf2011 - Schwaber Ken: "Scrum: Necessary but not sufficient for agility"
ESEconf2011 - Schwaber Ken: "Scrum: Necessary but not sufficient for agility"ESEconf2011 - Schwaber Ken: "Scrum: Necessary but not sufficient for agility"
ESEconf2011 - Schwaber Ken: "Scrum: Necessary but not sufficient for agility"Aberla
 
ESEconf2011 - Kaiser Traian: "How to measure productivity in software develop...
ESEconf2011 - Kaiser Traian: "How to measure productivity in software develop...ESEconf2011 - Kaiser Traian: "How to measure productivity in software develop...
ESEconf2011 - Kaiser Traian: "How to measure productivity in software develop...Aberla
 
ESEconf2011 - Haas Thomas & Jenni Joscha: "Ein Softwareprojekt zum Festpreis ...
ESEconf2011 - Haas Thomas & Jenni Joscha: "Ein Softwareprojekt zum Festpreis ...ESEconf2011 - Haas Thomas & Jenni Joscha: "Ein Softwareprojekt zum Festpreis ...
ESEconf2011 - Haas Thomas & Jenni Joscha: "Ein Softwareprojekt zum Festpreis ...Aberla
 
ESEconf2011 - Buschmann Frank: "What architects need to know"
ESEconf2011 - Buschmann Frank: "What architects need to know"ESEconf2011 - Buschmann Frank: "What architects need to know"
ESEconf2011 - Buschmann Frank: "What architects need to know"Aberla
 
ESEconf2011 - Arrenbrecht Peter: "Literate Testing: Stimmige API's machen meh...
ESEconf2011 - Arrenbrecht Peter: "Literate Testing: Stimmige API's machen meh...ESEconf2011 - Arrenbrecht Peter: "Literate Testing: Stimmige API's machen meh...
ESEconf2011 - Arrenbrecht Peter: "Literate Testing: Stimmige API's machen meh...Aberla
 

Mehr von Aberla (20)

Mobile Banking 2011: Clairmail
Mobile Banking 2011: ClairmailMobile Banking 2011: Clairmail
Mobile Banking 2011: Clairmail
 
Mobile Banking 2011: DAB
Mobile Banking 2011: DABMobile Banking 2011: DAB
Mobile Banking 2011: DAB
 
Mobile Banking 2011: Sparkasse
Mobile Banking 2011: SparkasseMobile Banking 2011: Sparkasse
Mobile Banking 2011: Sparkasse
 
Mobile Banking 2011: Credit Suisse
Mobile Banking 2011: Credit SuisseMobile Banking 2011: Credit Suisse
Mobile Banking 2011: Credit Suisse
 
Mobile Banking 2011: Danske Bank
Mobile Banking 2011: Danske BankMobile Banking 2011: Danske Bank
Mobile Banking 2011: Danske Bank
 
Mobile Banking 2011: Postfinance
Mobile Banking 2011: PostfinanceMobile Banking 2011: Postfinance
Mobile Banking 2011: Postfinance
 
ESeconf2011 - Haug Thomas: "Sauberer Code mit Metriken"
ESeconf2011 - Haug Thomas: "Sauberer Code mit Metriken"ESeconf2011 - Haug Thomas: "Sauberer Code mit Metriken"
ESeconf2011 - Haug Thomas: "Sauberer Code mit Metriken"
 
ESEconf2011 - Cruywagen Leon: "Cool ways to work smarter in the cloud"
ESEconf2011 - Cruywagen Leon: "Cool ways to work smarter in the cloud"ESEconf2011 - Cruywagen Leon: "Cool ways to work smarter in the cloud"
ESEconf2011 - Cruywagen Leon: "Cool ways to work smarter in the cloud"
 
ESEconf2011 - Wichmann Klaus-Peter: "Kennen Sie die Leistungsfähigkeit Ihres ...
ESEconf2011 - Wichmann Klaus-Peter: "Kennen Sie die Leistungsfähigkeit Ihres ...ESEconf2011 - Wichmann Klaus-Peter: "Kennen Sie die Leistungsfähigkeit Ihres ...
ESEconf2011 - Wichmann Klaus-Peter: "Kennen Sie die Leistungsfähigkeit Ihres ...
 
ESEconf2011 - Hanin Makram: "Embedding Performance into Continuous Integratio...
ESEconf2011 - Hanin Makram: "Embedding Performance into Continuous Integratio...ESEconf2011 - Hanin Makram: "Embedding Performance into Continuous Integratio...
ESEconf2011 - Hanin Makram: "Embedding Performance into Continuous Integratio...
 
ESEconf2011 - Lorenz Oliver: "'Agil heisst nicht beliebit' - Scrum als wirksa...
ESEconf2011 - Lorenz Oliver: "'Agil heisst nicht beliebit' - Scrum als wirksa...ESEconf2011 - Lorenz Oliver: "'Agil heisst nicht beliebit' - Scrum als wirksa...
ESEconf2011 - Lorenz Oliver: "'Agil heisst nicht beliebit' - Scrum als wirksa...
 
ESEconf2011 - Schilling Rüdiger: "Generative Konzepte für den Plattform-Zoo -...
ESEconf2011 - Schilling Rüdiger: "Generative Konzepte für den Plattform-Zoo -...ESEconf2011 - Schilling Rüdiger: "Generative Konzepte für den Plattform-Zoo -...
ESEconf2011 - Schilling Rüdiger: "Generative Konzepte für den Plattform-Zoo -...
 
ESEconf2011 - Freixa Vidal Roger: "Oracle's Java Strategy"
ESEconf2011 - Freixa Vidal Roger: "Oracle's Java Strategy"ESEconf2011 - Freixa Vidal Roger: "Oracle's Java Strategy"
ESEconf2011 - Freixa Vidal Roger: "Oracle's Java Strategy"
 
ESEconf2011 - Westphal Ralf: "Slice me nice - Produktiv, schnell, zufrieden"
ESEconf2011 - Westphal Ralf: "Slice me nice - Produktiv, schnell, zufrieden"ESEconf2011 - Westphal Ralf: "Slice me nice - Produktiv, schnell, zufrieden"
ESEconf2011 - Westphal Ralf: "Slice me nice - Produktiv, schnell, zufrieden"
 
ESEconf2011 - Caine Matthew: "Creating an Environment of Teamwork, Quality, I...
ESEconf2011 - Caine Matthew: "Creating an Environment of Teamwork, Quality, I...ESEconf2011 - Caine Matthew: "Creating an Environment of Teamwork, Quality, I...
ESEconf2011 - Caine Matthew: "Creating an Environment of Teamwork, Quality, I...
 
ESEconf2011 - Schwaber Ken: "Scrum: Necessary but not sufficient for agility"
ESEconf2011 - Schwaber Ken: "Scrum: Necessary but not sufficient for agility"ESEconf2011 - Schwaber Ken: "Scrum: Necessary but not sufficient for agility"
ESEconf2011 - Schwaber Ken: "Scrum: Necessary but not sufficient for agility"
 
ESEconf2011 - Kaiser Traian: "How to measure productivity in software develop...
ESEconf2011 - Kaiser Traian: "How to measure productivity in software develop...ESEconf2011 - Kaiser Traian: "How to measure productivity in software develop...
ESEconf2011 - Kaiser Traian: "How to measure productivity in software develop...
 
ESEconf2011 - Haas Thomas & Jenni Joscha: "Ein Softwareprojekt zum Festpreis ...
ESEconf2011 - Haas Thomas & Jenni Joscha: "Ein Softwareprojekt zum Festpreis ...ESEconf2011 - Haas Thomas & Jenni Joscha: "Ein Softwareprojekt zum Festpreis ...
ESEconf2011 - Haas Thomas & Jenni Joscha: "Ein Softwareprojekt zum Festpreis ...
 
ESEconf2011 - Buschmann Frank: "What architects need to know"
ESEconf2011 - Buschmann Frank: "What architects need to know"ESEconf2011 - Buschmann Frank: "What architects need to know"
ESEconf2011 - Buschmann Frank: "What architects need to know"
 
ESEconf2011 - Arrenbrecht Peter: "Literate Testing: Stimmige API's machen meh...
ESEconf2011 - Arrenbrecht Peter: "Literate Testing: Stimmige API's machen meh...ESEconf2011 - Arrenbrecht Peter: "Literate Testing: Stimmige API's machen meh...
ESEconf2011 - Arrenbrecht Peter: "Literate Testing: Stimmige API's machen meh...
 

Python Mike Müller

  • 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
  • 5. Anwender • Open Source • Google (Kern-Entwickler) • YouTube • Deutsche Luft- und Raumfahrt • NASA • Walt Disney • Rackspace • ...
  • 6. Anwender • Programmieranfänger • Softwareentwickler • Tester • Systemadminstratoren • Wissenschaftler und Ingenieure • Python skaliert • leichter Einstieg • viele fortgeschrittene Möglichkeiten (Meta-Programmierung)
  • 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ß
  • 9. Betriebssysteme • Windows • Linux • Mac • Main-Frames • Mobile Geräte • DOS
  • 10. Technologie • Interpreter • Plattformunabhängiger Bytecode • Fast alles zur Laufzeit • Einfache Meta-Programmierung
  • 11. Implementierungen • CPython == Standard Python • Jython in Java • IronPython in C# • PyPy in Python • Stackless • Mehr
  • 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.)
  • 16. Syntax • Einrückungen zählen • Compiler "sieht" Quelltext genauso wie Programmierer • Einrückung nach Doppelpunkt • Ausrückung zeigt Endes eines Blockes an • Ausführbarer Pseudocode • Elegant
  • 17. Interaktiver Modus >>> 1 + 1 2 >>> def add(x, y): ... return x + y ... >>> add(12, 14) 26
  • 18. Scripte # add.py def add(x, y): return x + y print add(12, 14) Ausgabe: 26
  • 19. Datenstrukturen • Eingebaut • Fester Bestandteil der Sprache • Listen • Dictionarys
  • 20. Listen >>> my_list = [10, 20, 30, 40, 50] >>> my_list[0] 10 >>> my_list[1] 20 >>> my_list[-1] 50 >>> my_list[1:3] [20, 30] >>> my_list[::2] [10, 30, 50]
  • 21. Listen >>> my_list.append(60) >>> my_list [10, 20, 30, 40, 50, 60] >>> my_list.append([1, 2, 3]) >>> my_list [10, 20, 30, 40, 50, 60, [1, 2, 3]] >>> my_list[-1] = 70 >>> my_list [10, 20, 30, 40, 50, 60, 70]
  • 22. List Comprehension • von Haskell abgeschaut >>> [item * 2 for item in my_list] [20, 40, 60, 80, 100, 120, 140] >>> [item * 2 for item in my_list if item > 40] [100, 120, 140] >>>
  • 23. Dictionarys • Hash-Tabellen • Assoziative Arrays >>> my_dict = {'a': 100, 'b': 200, 'c': 300} >>> my_dict {'a': 100, 'c': 300, 'b': 200} >>> my_dict['a'] 100
  • 24. Dictionarys >>> my_dict['x'] Traceback (most recent call last): File "<interactive input>", line 1, in <module> KeyError: 'x' >>> my_dict['x'] = 3 >>> my_dict {'a': 100, 'x': 3, 'c': 300, 'b': 200} >>> my_dict['a'] = -1 >>> my_dict {'a': -1, 'x': 3, 'c': 300, 'b': 200}
  • 25. Objektorientierung >>> class MyClass(object): ... def __init__(self, attr1, attr2): ... self.attr1 = attr1 ... self.attr2 = attr2 ... def get_sum(self): ... return self.attr1 + self.attr2 ... >>> my_instance = MyClass(10, 12) >>> my_instance.get_sum() 22
  • 26. Objektorientierung >>> my_instance.attr1 10 >>> my_instance.attr2 12 >>> my_instance.attr1 = 100 >>> my_instance.attr1 100 >>> my_instance.get_sum() 112
  • 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!