Raymond Hettinger <rhettin...@users.sourceforge.net> added the comment:

> how about we give every function a `.__parent_class__` 
> attribute saying which class it is a method of? 

Won't work.  The same function can be used in multiple classes.

The function object is independent of the class.  This is conceptually no 
different that the unremarkable fact that any object can be stored in multiple 
dictionaries and the object is not responsible for knowing which dictionaries 
it is stored in.

def f(self): ...   # not even defined inside a class
A.f = f            # stored in class A
B.f = f            # also stored in class B
dir(f)             # f doesn't know where it is stored

----------

_______________________________________
Python tracker <rep...@bugs.python.org>
<http://bugs.python.org/issue9276>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to