Your SlideShare is downloading. ×
Python @ PiTech - March 2009
Upcoming SlideShare
Loading in...5
×

Thanks for flagging this SlideShare!

Oops! An error has occurred.

×
Saving this for later? Get the SlideShare app to save on your phone or tablet. Read anywhere, anytime – even offline.
Text the download link to your phone
Standard text messaging rates apply

Python @ PiTech - March 2009

207
views

Published on

Published in: Technology, Education

0 Comments
0 Likes
Statistics
Notes
  • Be the first to comment

  • Be the first to like this

No Downloads
Views
Total Views
207
On Slideshare
0
From Embeds
0
Number of Embeds
1
Actions
Shares
0
Downloads
0
Comments
0
Likes
0
Embeds 0
No embeds

Report content
Flagged as inappropriate Flag as inappropriate
Flag as inappropriate

Select your reason for flagging this presentation as inappropriate.

Cancel
No notes for slide

Transcript

  • 1. PiTechnologies Tudor Prodan March 2009
  • 2. 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
  • 3. JythonJython, lest you do not know of it, is the mostcompelling weapon the Java platform has for itssurvival into the 21st century :-) —Sean McGrath, CTO, Propylon July 31, 2003
  • 4. CPythonVersion history: 1.0 – Jan 1994 2.0 – Oct 2000 3.0 – Dec 2008Latest stable versions: 2.6.1 and 3.0.1Usable versions: 2.5.x 2.6.x = 2.5 + improvements + 3.0 features (__future__) | | |__ maintenance version | |____ minor version |______ major version
  • 5. Why Python?
  • 6. Why Python programming is fun again
  • 7. Unfinished gameThe problem of the unfinished game:Lets 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
  • 8. Unfinished gameJava
  • 9. Unfinished gameC#
  • 10. Unfinished gamePython
  • 11. Unfinished game LoC readable? fun?Java 53 barely nopeC# 49 kind of not reallyPython 10 clean, much more fun concise than the above
  • 12. Why Python programming is fun again agility elegance you dont have to fight the language
  • 13. Why PythonJava is the COBOL of the 21st century. -Sean Kelly, JPL, NASA
  • 14. Spirit of CPython is close to the “Spirit of C” (more than C++/Java/...), as per ISO C Standards “rationale”: trust the programmer dont prevent the programmer from doing what needsto be done keep the language small and simple provide only one way to do an operation make it fast, even if its not guaranteed to beportable (the only bit not @100% in Python)
  • 15. 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
  • 16. Python vs. C(++,#)/Java/..In the 1960s the KGB was very interested in learning everythingpossible about the American space program, sending all sorts ofspies to find every possible piece of information.One afternoon, a breathless spy returned to headquarters with apiece of paper in his hand, excitedly shouting to his superior,"Comrade! Comrade! The Americans are using Lisp to write theirrocket launching software!“The commander was skeptical. "How do you know?""I broke into their research lab and stole a page from theteletype machine! Its not the whole program, but its the finalpage and contains the concluding logic of the program! See foryourself!"The commander looked at the page and smiled:
  • 17. Python vs. C(++,#)/Java/..)))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))
  • 18. Why PythonExample #2:Create a Coordinate classwhich holds a latitude and longitude,to be used by a TelemetryTracker object.
  • 19. Why Pythonthis example will show Python vs. Javabut is actually Python vs. Java / C# / PHP / (most others)
  • 20. Why PythonJava:
  • 21. PhilosophyYou know youve reached perfection in design, notwhen you have nothing more to add, but when you havenothing more to take away. -Antoine de Saint Exupery
  • 22. Why PythonJava: Python:
  • 23. Why PythonThe Java guys will say: my IDE can generate most of that - code is read a lot more than written
  • 24. Why PythonThe 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
  • 25. Why PythonThe 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 cant we apply this to other languages?
  • 26. Why PythonJava: Python:
  • 27. Why PythonEventually, the code will end up in production..Java: Python:
  • 28. Why Python.. time passes ..
  • 29. Why Python.. time passes ..Eventually, decodeLat receives bad dataThis is a bug!What do we do? - add a check
  • 30. Why PythonAdd a setter and a getter:
  • 31. Why PythonAdd a setter and a getter:Lets try it out:
  • 32. Why Pythonand the TelemetryTracker code:Python: - still worksJava: - needs modification
  • 33. Why Pythonin the end:Python: - gives you a choice - you can even change your mindJava/C#/PHP/..: - no choice
  • 34. Why Python programming is fun again agility elegance you dont have to fight the language the language trusts you .. it accommodates you
  • 35. Why Python programming is fun again agility elegance you dont have to fight the language the language trusts you .. it accommodates you .. and will not go out of its way to stop you
  • 36. Why PythonPython haslots &LOTSof goodbooks:
  • 37. Why Python programming is fun again agility elegance you dont have to fight the language the language trusts you .. it accommodates you .. and will not go out of its way to stop you good documentation (lots of books) good support: lots of forums, mailing lists, IRC
  • 38. Why PythonLarge number of high quality 3rd-party libraries andframeworks:- 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
  • 39. Why Python programming is fun again agility elegance you dont have to fight the language the language trusts you .. it accommodates you .. and will not go out of its way to stop you good documentation (lots of books) good support: lots of forums, IRC, mailing lists lots of high quality 3rd-party libraries
  • 40. Why PythonBut most interesting to us,lots of great web frameworks:
  • 41. Why Python programming is fun again agility elegance you dont have to fight the language the language trusts you .. it accommodates you .. and will not go out of its 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

×