10
Python 45s #4 Weekly hangt by @AlSayed gamal 1

Python 45 minutes Hangouts #4

Embed Size (px)

Citation preview

Page 1: Python 45 minutes Hangouts  #4

Python 45s #4Weekly hangout by @AlSayed gamal

�1

Page 2: Python 45 minutes Hangouts  #4

Last HangoutsLanguage Basic Syntax.

Branching and Loops.

Functions.

Data Structures.

Exceptions.

Modules.

I/O and Files.

�2

Page 3: Python 45 minutes Hangouts  #4

This hangout

Command Line Arguments

Advanced Iteration.

Debugging.

Next on Python45s

�3

Page 4: Python 45 minutes Hangouts  #4

CLI Options

From optparse import OptionParser

Short and long options.

actions and store actions

parser.print_help()

Page 5: Python 45 minutes Hangouts  #4

CLI Options (2)

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

parser = OptionParser(option_list=option_list)

Page 6: Python 45 minutes Hangouts  #4

Advanced Iteration

List comprehension

Generator Expression

Generator Functions

Item0Item1

Item2

next()

next()next()

Item3

Item2

next()next()

Item3

Item ?

next()

Page 7: Python 45 minutes Hangouts  #4

–Edsger Dijkstra*

“If debugging is the process of removing software bugs, then programming must be

the process of putting them in.”

* http://en.wikipedia.org/wiki/Edsger_W._Dijkstra

Page 8: Python 45 minutes Hangouts  #4

Debugging

Find the bug first.

pdb

pdb.set_trace()

Page 9: Python 45 minutes Hangouts  #4

Next on 45sAs if you are watching MBC Action :)

Page 10: Python 45 minutes Hangouts  #4

Thank youDon’t forget to post your question if any