Python 45s #4
Weekly hangout by @AlSayed gamal

1
Last Hangouts
Language Basic Syntax.
Branching and Loops.
Functions.
Data Structures.
Exceptions.
Modules.
I/O and Files.
2
This hangout
Command Line Arguments
Advanced Iteration.
Debugging.
Next on Python45s

3
CLI Options
From optparse import
OptionParser
Short and long options.
actions and store actions
parser.print_help()
CLI Options (2)
option_list = [

make_option("-f", “--filename", action="store",
type="string", dest=“filename”)

,..

]
parser = OptionParser(option_list=option_list)
Advanced Iteration
Item0
List comprehension
Generator Expression
Generator Functions

next()
Item2

next()
Item ?

next()
Item1

next()
Item3
“If debugging is the process of removing
software bugs, then programming must be
the process of putting them in.”
–Edsger Dijkstra*

* http://en.wikipedia.org/wiki/Edsger_W._Dijkstra
Debugging
Find the bug first.
pdb
pdb.set_trace()
Next on 45s
As if you are watching MBC Action :)
Thank you
Don’t forget to post your question if any

Python 45 minutes Hangouts #4