
Feb. 17, 2016
11:35 p.m.
On Feb 16, 2016, at 4:07 PM, Terry Reedy <tjreedy@udel.edu> wrote:
Since writing this, I realized that defining a custom class and using bound methods is a fourth option, which I also like. This binds the differentiating data to an instance, which is then bound to the function, rather than to the function directly. A toy example:
Does this deserve a link to the closures == classes koan? I think so :-) https://people.csail.mit.edu/gregs/ll1-discuss-archive-html/msg03277.html Anywhere someone suggests a closure, a class can probably do the work. And vice-versa, though one will often be more elegant than the other for a particular circumstance.