Udacity–CS212- Session II
Generator expressions.
How are generator expressions different from list comprehensions
Returns a iterator and a promise to go over the conditions
use it in a for loop to avoid stop iteration error
For loop
Creates an iterator and loop till the next item in iterator raises an exception
Design
Concept inventory
Refine ideas
Simple implementation
Back envelope
Refine Code
Tools
Need to learn about regular expressions
Anytime you see a leading 0 and you want to evaluate the expression, just rule it out
Write a generator Function instead of a normal function. Amazing stuff of python.
import cProfile ; cProfile.run
Python features – List comprehensions
Generator expressions
Generator functions – yield statement
Polymorphism – timedcalls ( n) could be either an integer or float – isinstance
eval function
instrumentation – time.clock(), timecalled, counting, profiler, variable naming conventions