Message129797
| 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:58 | rhettinger | set | recipients:
+ rhettinger, lemburg, loewis, hinsen, exarkun, belopolsky, pitrou, alexandre.vassalotti, eric.araujo, obamausa8, cool-RR |
| 2011年03月01日 19:39:58 | rhettinger | set | messageid: <1299008398.69.0.778464323604.issue9276@psf.upfronthosting.co.za> |
| 2011年03月01日 19:39:55 | rhettinger | link | issue9276 messages |
| 2011年03月01日 19:39:55 | rhettinger | create |
|