Steven D'Aprano <st...@pearwood.info>: > One technique which is common in Pascal, but less so in Python, is to get > the best of both worlds by using nested functions. In Python syntax: > > def Do_The_Thing(): > def internal_subpart_start(): ... > def internal_subpart_middle(): ... > def internal_subpart_end(): ... > ...
That really should be done more. C weaned us from the routine Pascal mechanism, but there's no reason not to exploit it again in Python. It also solves the problem of lugging the local context between internal functions, especially now that Python possesses the "nonlocal" keyword. Marko -- https://mail.python.org/mailman/listinfo/python-list