RSS Feed Subscribe to RSS Feed

 

Code Camp: What is Python?

What is Python?

Speaker: Wesley Chun (wescpy@gmail.com)

Intro (from Wikipedia)

Python is a general-purpose, high-level programming language. Its design philosophy emphasizes programmer productivity and code readability. It supports multiple programming paradigms (primarily object oriented, imperative, and functional) and features a fully dynamic type system and automatic memory management. it is often used as a scripting language.

Background

  • Invented by a Dutchman (Guido van Rossum) in 89 (released 91)
  • Inherits from C/C++, LISP, Perl, Java amongst others…
  • Named after Monty Python
  • Used a lot for QA and Testing

Topics Wes will cover:

  • Python Object Types
  • Loops and conditionals
  • Files, Functions and Modules
  • OOP
  • Philosophy, Concepts, Syntax

Why Python?
Advantages:

  • Simle syntax
  • Rapid development
  • Mutli platform OS
  • OO
  • Exception Handling
  • Functional programming (incl Lambda)
  • Multi threaded
  • Memory managemwnt (just like Java)
  • Extensible

Disadvantages

  • Slower than standard compiled languages (like C, C++). Also slower than Java.
  • Obscure syntax (indentation rather than braces)
  • Some idiosyncrasies
  • Little marketting (mostly word of mouth)

Objects

  • Allocated on assignment (Dynamic typing) – i.e. x=5 {compiler figures out x is of type number}
  • Uses refs (aka aliases), similar to pointers
  • Call by reference or value? Both. Neither. Depends on the object!
  • Memory management – done by reference counting.

Variables and Expressions

  • a = 123 //Note no declarations needed
  • a = ‘Python’ (123 can now be garbage collected);

Constructs

  • Lists are Python’s arrays. But there are heterogeneous.
  • Dictionaries – Python’s only mapping type
    Mutable, resizable hash tables
    Mappings of keys to values
    Key collisions are not allowed
    Values are arbitrary Python objects
    e.g. d.keys() //list pf keys

Finally

  • Python 3 will not be backwards compatible (currently on v2.6)

Links

One Response to “Code Camp: What is Python?”

  1. Steve Achabal |

    Cool Thanks for this post. I am a newbie at django and this will help a lot.

Leave a Reply