Message189165
| Author |
gvanrossum |
| Recipients |
amaury.forgeotdarc, daniel.urban, fdrake, gvanrossum, isoschiz, kristjan.jonsson, ncoghlan, pconnell, pitrou |
| Date |
2013年05月13日.18:47:13 |
| SpamBayes Score |
-1.0 |
| Marked as misclassified |
Yes |
| Message-id |
<1368470833.86.0.778335897202.issue17950@psf.upfronthosting.co.za> |
| In-reply-to |
| Content |
I think turning the __mro__ tuple into a getter is fine. As long as this works I'm okay:
class C: ...
mro = C.__mro__
del C
assert mro[0].__name__ == 'C'
(The last assert stands in for asserting that the class object must stay alive as long as the tuple returned by __mro__ is alive.)
I think it's also fine if the descriptors contain weak references. Its hard to get a "raw" descriptor anyways -- you can't say C.desc, you'd have to say C.__dict__['desc']. |
|