Aahz a écrit :
> If you were going to name three or five essential recipes from the
> Python Cookbook suitable for beginners, what would you pick?
> 
> Yes, this is for _Python for Dummies_, so idioms that aren't in the
> Cookbook are also fine.


1/ tuple- and dict-based dispatch, ie:
x = (result_if_false, result_if_true)[boolexpr]
y = {key1: result1, key2:result2, ...}[keyexpr]

2/ functions (and methods etc) as first-class objects (two main obvious 
uses : callbacks and decorators)

+ (bonus) the combination of 1/ and 2/ !-)

3/ name-based lookups and affectations (getattr() / setattr()) and their 
implementation ( __getattr__ / __setattr__)



-- 
http://mail.python.org/mailman/listinfo/python-list

Reply via email to