"hello worldof the different stylesa class that creates callable adder instances class adder(object)def __init__(selfn)self def __call__(selfm)return self add _i adder( "instanceor "imperativewe have constructed something callable that adds five to an argument passed in seems simple and mathematical enough let us also try it as closuredef make_adder( )def adder( )return return adder add _f make_adder( "functionalso far these seem to amount to pretty much the same thingbut the mutable state in the instance provides attractive nuisanceadd _i( add _f( add _i add _i( only argument affects result state is readily changeable result is dependent on prior flow the behavior of an "addercreated by either adder(or make_adder(isof coursenot determined until runtime in general but once the object existsthe closure behaves in pure functional waywhile the class instance remains state dependent one might simply settle for "don' change that state"--and indeed that is possible (if no one else with poorer understanding imports and uses your code)--but one is accustomed to changing the state of instancesand style that prevents abuse programmatically encourages better habits there is little "gotchaabout how python binds variables in closures it does so by name rather than valueand that can cause confusionbut also has an easy solution for examplewhat if we want to manufacture several related closures encapsulating different data callables