3. What is Python
- a “very high-level language”
- developed by Guido van Rossum
- main features:
simple, yet powerful semantics
object-oriented, but multi-paradigm
clean syntax and coherent design
focus on productivity
rich standard library
lots of high quality 3rd-party
several good implementations:
CPython, Pypy, IronPython (2.0.1), PyS60, Jython
4. Jython
Jython, lest you do not know of it, is the most
compelling weapon the Java platform has for its
survival into the 21st century :-)
—Sean McGrath, CTO, Propylon
July 31, 2003
5. CPython
Version history:
1.0 – Jan 1994
2.0 – Oct 2000
3.0 – Dec 2008
Latest stable versions:
2.6.1 and 3.0.1
Usable versions:
2.5.x
2.6.x = 2.5 + improvements + 3.0 features
(__future__)
| | |__ maintenance version
| |____ minor version
|______ major version
10. Unfinished game
The problem of the unfinished game:
Let's say, hypothetically speaking,
you met someone who told you they had two children,
and one of them is a girl.
What are the odds that person has a boy and a girl?
-Jeff Atwood, December 30, 2008
http://www.codinghorror.com/blog
14. Unfinished game
LoC readable? fun?
Java 53 barely nope
C# 49 kind of not really
Python 10 clean, much more fun
concise than the above
15. Why Python
programming is fun again
agility
elegance
you don't have to fight the language
16. Why Python
Java is the COBOL of the 21st century.
-Sean Kelly, JPL, NASA
17. Spirit of C
Python is close to the “Spirit of C” (more than C++/
Java/...), as per ISO C Standard's “rationale”:
trust the programmer
don't prevent the programmer from doing what needs
to be done
keep the language small and simple
provide only one way to do an operation
make it fast, even if it's not guaranteed to be
portable (the only bit not @100% in Python)
18. Python vs. C(++,#)/Java/..
everything is a first-class object
- functions, methods, modules, ..
typing: strong, but dynamic
- names have no type, objects have types
no “declarations”, just statements
- implicit compilation, .pyc files
- everything is run-time (compile-time too)
spare syntax, minimal ornamentation
- no { } for blocks
- no ( ) for conditions
- a lot less punctuation
19. Python vs. C(++,#)/Java/..
In the 1960's the KGB was very interested in learning everything
possible about the American space program, sending all sorts of
spies to find every possible piece of information.
One afternoon, a breathless spy returned to headquarters with a
piece of paper in his hand, excitedly shouting to his superior,
"Comrade! Comrade! The Americans are using Lisp to write their
rocket launching software!“
The commander was skeptical. "How do you know?"
"I broke into their research lab and stole a page from the
teletype machine! It's not the whole program, but it's the final
page and contains the concluding logic of the program! See for
yourself!"
The commander looked at the page and smiled:
24. Philosophy
You know you've reached perfection in design, not
when you have nothing more to add, but when you have
nothing more to take away.
-Antoine de Saint Exupery
26. Why Python
The Java guys will say:
my IDE can generate most of that
- code is read a lot more than written
27. Why Python
The Java guys will say:
my IDE can generate most of that
- code is read a lot more than written
but, your fields are public
- Python philosophy
28. Why Python
The Java guys will say:
my IDE can generate most of that
- code is read a lot more than written
but, your fields are public
- Python philosophy
can't we apply this to other languages?
35. Why Python
and the TelemetryTracker code:
Python:
- still works
Java:
- needs modification
36. Why Python
in the end:
Python:
- gives you a choice
- you can even change your mind
Java/C#/PHP/..:
- no choice
37. Why Python
programming is fun again
agility
elegance
you don't have to fight the language
the language trusts you
.. it accommodates you
38. Why Python
programming is fun again
agility
elegance
you don't have to fight the language
the language trusts you
.. it accommodates you
.. and will not go out of it's way to stop you
40. Why Python
programming is fun again
agility
elegance
you don't have to fight the language
the language trusts you
.. it accommodates you
.. and will not go out of it's way to stop you
good documentation (lots of books)
good support: lots of forums, mailing lists, IRC
41.
42. Why Python
Large number of high quality 3rd-party libraries and
frameworks:
- networking: twisted, cogen, concurrence
- scientific: NumPy, ScyPy, PyEvolve (genetic algorithms)
- testing: PyUnit, Google Mox
- fuzzing: Fuzz
- database: SQLAlchemy, Elixir, Django ORM
- web crawling: BeautifulSoup, lxml, Scrappy
- game development: PyGame
- GUI: PyGTK, wxPython, PyQt, GTK#
-templating: Genshi, Mako, Kid, Jinja2
- cryptography: M2Crypto, PyCrypto, Keyczar,
.. many, many others
43. Why Python
programming is fun again
agility
elegance
you don't have to fight the language
the language trusts you
.. it accommodates you
.. and will not go out of it's way to stop you
good documentation (lots of books)
good support: lots of forums, IRC, mailing lists
lots of high quality 3rd-party libraries
45. Why Python
programming is fun again
agility
elegance
you don't have to fight the language
the language trusts you
.. it accommodates you
.. and will not go out of it's way to stop you
good documentation (lots of books)
good support: lots of forums, IRC, mailing lists
lots of high quality 3rd-party libraries
many great web frameworks