On 9/7/07, Brett Cannon <[EMAIL PROTECTED]> wrote: > On 9/7/07, Jim Jewett <[EMAIL PROTECTED]> wrote: > > > A Signature object has the following structure attributes: > > > > > * name : str > > > Name of the function. This is not fully qualified because > > > function objects for methods do not know the class they are > > > contained within. This makes functions and methods > > > indistinguishable from one another when passed to decorators, > > > preventing proper creation of a fully qualified name. > > > > (1) Would this change with the new static __class__ attribute used > > for the new super? > > I don't know enough about the super implementation to know. If you > can figure out the class from the function object alone then sure, > this can change.
I don't think it'll work -- the __class__ variable is only available *within* the function, not when one is introspecting the function object. Also, it is only available for functions that reference 'super' (or __class__ directly). As __class__ is passed into the function call as a "cell" variable (like references to variables from outer scopes), its mere presense slows down the call somewhat, hence it is only present when used. (BTW, it is not an attribute.) BTW there's a good reason why functions don't have easier access to the class in which they are defined: functions can easily be moved or shared between classes. The __class__ variable only records the class inside which the function is defined lexically, if any. -- --Guido van Rossum (home page: http://www.python.org/~guido/) _______________________________________________ Python-Dev mailing list Python-Dev@python.org http://mail.python.org/mailman/listinfo/python-dev Unsubscribe: http://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com