
Russ Paielli wrote: ...
instance for which it is called. What I will say is that I think Python syntax could be significantly simplified with the simple little convention that I am proposing. All I ask is that you carefully read my proposal before you reply. Thank you.
I have. It strikes me as an improvement over .attr and other ideas posted on c.l.p. In Python, the class instance for which a method is called is referred to within the method by the first formal argument. Somehow awkward. By convention, that first argument is typically named "self". For public code among English speakers. But how far this extends and for how long, given Unicode identifiers in 3.0, is a moot point for your proposal. In Python, class instance methods are functions in which the first formal argument refers to the instance for which the method was called. In Python, class instance methods are functions accessed as an attribute of the class, in particular of the object passed as the first argument. To me your discussion is weakened by the implication that Python has a method class separate from functions. (Bound methods are specialized partial-function wrappers; functools.partial is the general version.) For instance could even work for regular functions if the first argument is an object with attributes and/or methods that can be accessed with standard "dot" notation. Def statements produce functions. Period. This proposal takes no position of whether the latter should be allowed or not. To repeat: former *is* latter with a particular access path. So the question is not whether to 'allow' $ to work in functions; that *is* your proposal, whether you know it or not. To do otherwise would require some other significant change to Python, one that would complicate it. Four possible candidates for the choice of that symbol are "~", "@", "^", and "$". You left out "?" (not too good ;-) and now, in 3.0, "`" (backtick, no longer an repr synonym). The latter is lighter than "$" but perhaps more visible than ".", depending on the font. Hmmm, a comparison: self.d = sqrt(self.x*self.x + self.y*self.y) s.d = sqrt(s.x*s.x + s.x*s.x) .d = sqrt(.x*.x + .y*.y) $d = sqrt($x*$x + $y*$y) `d = sqrt(`s*`x + `y*`y) I think I like this last best. Terry Jan Reedy