Successfully reported this slideshow.
We use your LinkedIn profile and activity data to personalize ads and to show you more relevant ads. You can change your ad preferences anytime.
Introduction to Python <ul><li>A readable, dynamic, pleasant,  </li></ul><ul><li>flexible, fast and powerful language </li...
Overview <ul><li>Background </li></ul><ul><li>Syntax </li></ul><ul><li>Types / Operators / Control Flow </li></ul><ul><li>...
What is Python <ul><li>Multi-purpose (Web, GUI, Scripting, etc.) </li></ul><ul><li>Object Oriented </li></ul><ul><li>Inter...
Features <ul><li>Batteries Included </li></ul><ul><li>Everything is an Object </li></ul><ul><li>Interactive Shell </li></u...
Who Uses Python <ul><li>Google </li></ul><ul><li>PBS </li></ul><ul><li>NASA </li></ul><ul><li>Library of Congress </li></u...
Releases <ul><li>Created in 1989 by Guido Van Rossum </li></ul><ul><li>Python 1.0 released in 1994 </li></ul><ul><li>Pytho...
Syntax
Hello World hello_world.py
Indentation <ul><li>Most languages don’t care about indentation </li></ul><ul><li>Most humans do </li></ul><ul><li>We tend...
Indentation The else here actually belongs to the 2nd if statement
Indentation The else here actually belongs to the 2nd if statement
Indentation I knew a coder like this
Indentation You should always be explicit
Indentation Text Python embraces indentation
Comments
Types
Strings
Numbers
Null
Lists
Lists
Dictionaries
Dictionary Methods
Booleans
Operators
Arithmetic
String Manipulation
Logical Comparison
Identity Comparison
Arithmetic Comparison
Control Flow
Conditionals
For Loop
Expanded For Loop
While Loop
List Comprehensions <ul><li>Useful for replacing simple for-loops. </li></ul>
Functions
Basic Function
Function Arguments
Arbitrary Arguments
Fibonacci
Fibonacci Generator
Classes
Class Declaration
Class Attributes <ul><li>Attributes assigned at class declaration should always be immutable </li></ul>
Class Methods
Class Instantiation & Attribute Access
Class Inheritance
Python’s Way <ul><li>No interfaces </li></ul><ul><li>No real private attributes/functions </li></ul><ul><li>Private attrib...
Imports <ul><li>Allows code isolation and re-use </li></ul><ul><li>Adds references to variables/classes/functions/etc. int...
Imports
More Imports
Error Handling
Documentation
Docstrings
Tools
Web Frameworks <ul><li>Django </li></ul><ul><li>Flask </li></ul><ul><li>Pylons </li></ul><ul><li>TurboGears </li></ul><ul>...
IDEs <ul><li>Emacs </li></ul><ul><li>Vim </li></ul><ul><li>Komodo </li></ul><ul><li>PyCharm </li></ul><ul><li>Eclipse (PyD...
Package Management
Resources <ul><li>http://python.org / </li></ul><ul><li>http://diveintopython.org / </li></ul><ul><li>http://djangoproject...
Example
Going Further <ul><li>Decorators </li></ul><ul><li>Context Managers </li></ul><ul><li>Lambda functions </li></ul><ul><li>G...
Questions?
Thanks!
Upcoming SlideShare
Loading in …5
×

Introduction to Python

Introduction to Python slides from the Vermont Code Camp 2010 gathering.

  • Be the first to comment

Introduction to Python

  1. 1. Introduction to Python <ul><li>A readable, dynamic, pleasant, </li></ul><ul><li>flexible, fast and powerful language </li></ul>Nowell Strite Manager of Tech Solutions @ PBS [email_address]
  2. 2. Overview <ul><li>Background </li></ul><ul><li>Syntax </li></ul><ul><li>Types / Operators / Control Flow </li></ul><ul><li>Functions </li></ul><ul><li>Classes </li></ul><ul><li>Tools </li></ul>
  3. 3. What is Python <ul><li>Multi-purpose (Web, GUI, Scripting, etc.) </li></ul><ul><li>Object Oriented </li></ul><ul><li>Interpreted </li></ul><ul><li>Strongly typed and Dynamically typed </li></ul><ul><li>Focus on readability and productivity </li></ul>
  4. 4. Features <ul><li>Batteries Included </li></ul><ul><li>Everything is an Object </li></ul><ul><li>Interactive Shell </li></ul><ul><li>Strong Introspection </li></ul><ul><li>Cross Platform </li></ul><ul><li>CPython, Jython, IronPython, PyPy </li></ul>
  5. 5. Who Uses Python <ul><li>Google </li></ul><ul><li>PBS </li></ul><ul><li>NASA </li></ul><ul><li>Library of Congress </li></ul><ul><li>the ONION </li></ul><ul><li>...the list goes on... </li></ul>
  6. 6. Releases <ul><li>Created in 1989 by Guido Van Rossum </li></ul><ul><li>Python 1.0 released in 1994 </li></ul><ul><li>Python 2.0 released in 2000 </li></ul><ul><li>Python 3.0 released in 2008 </li></ul><ul><li>Python 2.7 is the recommended version </li></ul><ul><li>3.0 adoption will take a few years </li></ul>
  7. 7. Syntax
  8. 8. Hello World hello_world.py
  9. 9. Indentation <ul><li>Most languages don’t care about indentation </li></ul><ul><li>Most humans do </li></ul><ul><li>We tend to group similar things together </li></ul>
  10. 10. Indentation The else here actually belongs to the 2nd if statement
  11. 11. Indentation The else here actually belongs to the 2nd if statement
  12. 12. Indentation I knew a coder like this
  13. 13. Indentation You should always be explicit
  14. 14. Indentation Text Python embraces indentation
  15. 15. Comments
  16. 16. Types
  17. 17. Strings
  18. 18. Numbers
  19. 19. Null
  20. 20. Lists
  21. 21. Lists
  22. 22. Dictionaries
  23. 23. Dictionary Methods
  24. 24. Booleans
  25. 25. Operators
  26. 26. Arithmetic
  27. 27. String Manipulation
  28. 28. Logical Comparison
  29. 29. Identity Comparison
  30. 30. Arithmetic Comparison
  31. 31. Control Flow
  32. 32. Conditionals
  33. 33. For Loop
  34. 34. Expanded For Loop
  35. 35. While Loop
  36. 36. List Comprehensions <ul><li>Useful for replacing simple for-loops. </li></ul>
  37. 37. Functions
  38. 38. Basic Function
  39. 39. Function Arguments
  40. 40. Arbitrary Arguments
  41. 41. Fibonacci
  42. 42. Fibonacci Generator
  43. 43. Classes
  44. 44. Class Declaration
  45. 45. Class Attributes <ul><li>Attributes assigned at class declaration should always be immutable </li></ul>
  46. 46. Class Methods
  47. 47. Class Instantiation & Attribute Access
  48. 48. Class Inheritance
  49. 49. Python’s Way <ul><li>No interfaces </li></ul><ul><li>No real private attributes/functions </li></ul><ul><li>Private attributes start (but do not end) with double underscores. </li></ul><ul><li>Special class methods start and end with double underscores. </li></ul><ul><ul><li>__init__, __doc__, __cmp__, __str__ </li></ul></ul>
  50. 50. Imports <ul><li>Allows code isolation and re-use </li></ul><ul><li>Adds references to variables/classes/functions/etc. into current namespace </li></ul>
  51. 51. Imports
  52. 52. More Imports
  53. 53. Error Handling
  54. 54. Documentation
  55. 55. Docstrings
  56. 56. Tools
  57. 57. Web Frameworks <ul><li>Django </li></ul><ul><li>Flask </li></ul><ul><li>Pylons </li></ul><ul><li>TurboGears </li></ul><ul><li>Zope </li></ul><ul><li>Grok </li></ul>
  58. 58. IDEs <ul><li>Emacs </li></ul><ul><li>Vim </li></ul><ul><li>Komodo </li></ul><ul><li>PyCharm </li></ul><ul><li>Eclipse (PyDev) </li></ul>
  59. 59. Package Management
  60. 60. Resources <ul><li>http://python.org / </li></ul><ul><li>http://diveintopython.org / </li></ul><ul><li>http://djangoproject.com / </li></ul>
  61. 61. Example
  62. 62. Going Further <ul><li>Decorators </li></ul><ul><li>Context Managers </li></ul><ul><li>Lambda functions </li></ul><ul><li>Generators </li></ul><ul><li>... </li></ul>
  63. 63. Questions?
  64. 64. Thanks!

×