Using closures and partial functions to eliminate redundant code

Gabriel Genellina gagsl-py2 at yahoo.com.ar
Thu Sep 27 02:17:36 EDT 2007


En Wed, 26 Sep 2007 23:01:17 -0300, Matthew Wilson <matt at tplus1.com>  
escribi�:

> I wrote some code to create a user and update a user on a remote box by
> sending emails to that remote box.  When I was done, I realized that my
> create_user function and my update_user function were effectively
> identical except for different docstrings and a single different value
> inside:

I would have used an object with two methods... But this is just another  
example of the closure/object dichotomy. Some enlightment:
http://people.csail.mit.edu/gregs/ll1-discuss-archive-html/msg03277.html

-- 
Gabriel Genellina




More information about the Python-list mailing list