>>>>> "MvL" == Martin von Loewis <loewis at informatik.hu-berlin.de> writes: MvL> whisper at oz.net (Dave LeBlanc) writes: >> Since self is used for every method of every class, isn't it a >> bit redundant? I don't know of another OO language that makes you >> manually carry around the "this"/"self" pointer/reference... MvL> In Smalltalk, invocations of operations on self always require MvL> to provide the self argument. You don't have to declare it as a MvL> method argument, though. Modula-3 was mentioned in another post. There is a reason other than simple clarity (I like using an explicit self) for this approach. Python's rules for local variables would interfere with attribute access. Since Python eschews variable declarations, any assignment to a name inside a code block makes that name a local variable. By this rule alone, there would never by a way to assign to an instance variable :-). You'd need a mechanism like the global statement to say "This name isn't a local." We had an opportunity to change the attribute access approach when nested scopes were introduced, but we went out of our way (well, sort of) to preserve the self.attr approach. Jeremy
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