This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author rhettinger
Recipients alexandre.vassalotti, belopolsky, cool-RR, eric.araujo, exarkun, hinsen, lemburg, loewis, obamausa8, pitrou, rhettinger
Date 2011-03-01.19:39:55
SpamBayes Score 0.0008717058
Marked as misclassified No
Message-id <1299008398.69.0.778464323604.issue9276@psf.upfronthosting.co.za>
In-reply-to
Content
> 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
History
Date User Action Args
2011-03-01 19:39:58rhettingersetrecipients: + rhettinger, lemburg, loewis, hinsen, exarkun, belopolsky, pitrou, alexandre.vassalotti, eric.araujo, obamausa8, cool-RR
2011-03-01 19:39:58rhettingersetmessageid: <1299008398.69.0.778464323604.issue9276@psf.upfronthosting.co.za>
2011-03-01 19:39:55rhettingerlinkissue9276 messages
2011-03-01 19:39:55rhettingercreate