Upgrade to Pro — share decks privately, control downloads, hide ads and more …

Python @ PiTech, mar 2010

Avatar for Prody Prody
April 25, 2012

Python @ PiTech, mar 2010

Avatar for Prody

Prody

April 25, 2012
Tweet

Other Decks in Technology

Transcript

  1. What is Python - a “very high-level language” - developed

    by Guido van Rossum - main features: l  simple, yet powerful semantics l  object-oriented, but multi-paradigm l  clean syntax and coherent design l  focus on productivity l  rich standard library l  lots of high quality 3rd-party l  several good implementations: CPython, Pypy, IronPython (2.0.1), PyS60, Jython
  2. 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
  3. 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
  4. 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
  5. 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
  6. Why Python l  programming is fun again l  agility l 

    elegance l  you don't have to fight the language
  7. Spirit of C Python is close to the “Spirit of

    C” (more than C++/ Java/...), as per ISO C Standard's “rationale”: l  trust the programmer l  don't prevent the programmer from doing what needs to be done l  keep the language small and simple l  provide only one way to do an operation l  make it fast, even if it's not guaranteed to be portable (the only bit not @100% in Python)
  8. Python vs. C(++,#)/Java/.. l  everything is a first-class object -

    functions, methods, modules, .. l  typing: strong, but dynamic - names have no type, objects have types l  no “declarations”, just statements - implicit compilation, .pyc files - everything is run-time (compile-time too) l  spare syntax, minimal ornamentation - no { } for blocks - no ( ) for conditions - a lot less punctuation
  9. 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:
  10. Why Python Example #2: Create a Coordinate class which holds

    a latitude and longitude, to be used by a TelemetryTracker object.
  11. Why Python this example will show Python vs. Java but

    is actually Python vs. Java / C# / PHP / (most others)
  12. 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
  13. Why Python The Java guys will say: l  my IDE

    can generate most of that - code is read a lot more than written
  14. Why Python The Java guys will say: l  my IDE

    can generate most of that - code is read a lot more than written l  but, your fields are public - Python philosophy
  15. Why Python The Java guys will say: l  my IDE

    can generate most of that - code is read a lot more than written l  but, your fields are public - Python philosophy l  can't we apply this to other languages?
  16. Why Python .. time passes .. Eventually, decodeLat receives bad

    data This is a bug! What do we do? - add a check
  17. Why Python in the end: Python: - gives you a

    choice - you can even change your mind Java/C#/PHP/..: - no choice
  18. Why Python l  programming is fun again l  agility l 

    elegance l  you don't have to fight the language l  the language trusts you l  .. it accommodates you
  19. Why Python l  programming is fun again l  agility l 

    elegance l  you don't have to fight the language l  the language trusts you l  .. it accommodates you l  .. and will not go out of it's way to stop you
  20. Why Python l  programming is fun again l  agility l 

    elegance l  you don't have to fight the language l  the language trusts you l  .. it accommodates you l  .. and will not go out of it's way to stop you l  good documentation (lots of books) l  good support: lots of forums, mailing lists, IRC
  21. 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
  22. Why Python l  programming is fun again l  agility l 

    elegance l  you don't have to fight the language l  the language trusts you l  .. it accommodates you l  .. and will not go out of it's way to stop you l  good documentation (lots of books) l  good support: lots of forums, IRC, mailing lists l  lots of high quality 3rd-party libraries
  23. Why Python l  programming is fun again l  agility l 

    elegance l  you don't have to fight the language l  the language trusts you l  .. it accommodates you l  .. and will not go out of it's way to stop you l  good documentation (lots of books) l  good support: lots of forums, IRC, mailing lists l  lots of high quality 3rd-party libraries l  many great web frameworks