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.

Python 45 minutes hangout #3

1,081 views

Published on

In this hangout we will be talking about:
1-Files
2-Functional Programming
3-Passing arguments to your command line

Published in: Education, Technology
  • Be the first to comment

Python 45 minutes hangout #3

  1. 1. Python 45 Minutes By @AlSayed Gamal
  2. 2. Last Hangout ❖ Data types and containers ❖ Functions ❖ Exceptions ❖ Namespaces and modules ❖ Re-read the sorted list example.
  3. 3. In This Hangout ❖ Working with files ❖ Reading options passed to your program ❖ Functional programming ❖ Advanced iteration ❖ Debugging tools
  4. 4. Working With Files
  5. 5. Working With Files ❖ What’s simpler than open(“path/to/file”) ? ❖ Don’t forget to close the file (finally:) ❖ And even cleaner way use managed context (with:) ❖ File-like objects.
  6. 6. Reading CL Options
  7. 7. Reading Options ❖ from optparse import OptionParser ❖ Adding options (short and long), setting default values and errors ❖ using __main__ the entry point.
  8. 8. Functional Programming
  9. 9. Functional Programing ❖ Python is a multi-paradigm language (What does that mean?) ❖ Functions are objects and they are first class variables. ❖ Higher order functions ❖ Remember the first hangout example ?
  10. 10. Functional Programing (2) ❖ Anonymous functions (lambda) ❖ Nested functions (function that defines function) ❖ Closures and “Lexical Scoping” issue. ❖ Operators as functions ❖ Trying doctest. ❖ Decorators and (@notation).
  11. 11. Advanced Iteration
  12. 12. Advanced Iteration ❖ List comprehension ❖ Generator expressions ❖ Understanding yield ❖ itertools ❖ zip and izip
  13. 13. Questions?
  14. 14. Thank you :) @AlSayed Gamal

×