Frederic Rentsch wrote in news:mailman.1556.1162316571.11739.python- [EMAIL PROTECTED] in comp.lang.python:
> Rob Williscroft wrote: >> Frederic Rentsch wrote in news:mailman.1536.1162292996.11739.python- >>> Rob Williscroft wrote: >>>> Frederic Rentsch wrote in news:mailman.1428.1162113628.11739.python- [snip] >>>> >>> Here I'm lost. What's the advantage of this? It looks more convoluted. >>> >> >> I'll agree that having to explicitly define a namespace class first >> does add some convolution. >> >> But if you refer to having to prefix you "outer" variables with >> "scope." then this would be the same as claiming that the explict use >> of self is convoluted, which is a valid opinion, so fair enough, but >> I can't say that I agree. >> >> > > I didn't mean to call into question. I didn't understand the advantage > of the added complexity of your second example over the first. > Ok, I missed your point, as for the second example it was an attempt to show that further refactoring from a function with local functions that are sharing some state via the scope object, to a class with methods that share state via the instance, is a matter of editing a few lines. This is useful when a function grows too large (for some value of "too large"). As an added bonus you get to use the same thechniques with both styles of coding. [snip] Rob. -- http://www.victim-prime.dsl.pipex.com/ -- http://mail.python.org/mailman/listinfo/python-list