<James_Althoff at i2.com> wrote in message > Now suppose the call to collection.do(xxx) is in the middle of a > very long class def. Then I have to put the doThisAndDoThatToItem > def before the class or after the class thereby separating the definition > from its one and only use by possibly hundreds of lines of > code. This is not nice for readability. With the advent of nested_scopes, I believe you can accomplish this by just embedding a 'def' in either the __init__ or the collection.do function, making your code as readable as that smalltalk code was. :) For instance: class Dummy: def __init__(self, collection): def DoThisAndDoThatToItem(item): item.DoThis() item.DoThat() collection.do(DoThisAndDoThatToItem) Now. Is that readable? Its 'eh', but its far more readable then the Smalltalkism of 'named code blocks', and it doesn't seperate that function def from its one and only use, which is your other problem. --S (replace 'NOSPAM' with 'seraph' to respond in email)
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4