CRAZY: First class namespaces
Amit Patel
amitp at Xenon.Stanford.EDU
Tue May 30 14:32:18 EDT 2000
More information about the Python-list mailing list
Tue May 30 14:32:18 EDT 2000
- Previous message (by thread): CRAZY: First class namespaces
- Next message (by thread): CRAZY: First class namespaces
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Terry Reedy <tjreedy at udel.edu> wrote: | | "Amit Patel" <amitp at Xenon.Stanford.EDU> wrote > * Methods on objects: | > | > We have to resolve the issue of "self" being a magic argument. | | 'self' isn't. The first arg, whatever named, is. Your proposal would | mandate that this | arg be named 'self', which is not the case now. I usually just use 's'. Oops, sorry, I may have mixed things up. I wasn't referring to the name "self" but rather the first arg. I was still imagining that you define m(self, args). However, by saying classes and objects are the "same", we have to distinguish between unbound and bound methods: obj.foo = lambda self,x: self.foo(x) is what you do in a "class", vs. obj.foo = lambda x: x+3 is what you do in an "object". You can call obj.foo(5) either way, but in one case the system adds obj as the magic first argument and in the other case it doesn't. See, there's no syntax for distinguishing the two, because we use "def" for both functions and methods, and in Python 1 we use the context to decide what is defined. If we want to unify classes and objects (and I admit, I'm probably the only one who wants this), then we may need a way to say "I'm defining an unbound method" vs. "I'm defining a plain old function". - Amit -- -- Amit J Patel, Computer Science Department, Stanford University http://www-cs-students.stanford.edu/~amitp/
- Previous message (by thread): CRAZY: First class namespaces
- Next message (by thread): CRAZY: First class namespaces
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
More information about the Python-list mailing list