Message242254
| Author |
siming85 |
| Recipients |
siming85 |
| Date |
2015年04月29日.23:04:32 |
| SpamBayes Score |
-1.0 |
| Marked as misclassified |
Yes |
| Message-id |
<1430348672.59.0.934013457033.issue24078@psf.upfronthosting.co.za> |
| In-reply-to |
| Content |
if the same class name is used within a module, but defined in different contexts (either class in class or class in function), inspect.getsourcelines() on the class object ignores the object context and only returns the first matched name.
reproduce:
a.py
----
class A(object):
class B(object):
pass
class C(object):
class B(object):
pass
------------------
>>> import inspect
>>> import a
>>> inspect.getsourcelines(a.C.B)
([' class B(object):\n', ' pass\n'], 2) |
|
History
|
|---|
| Date |
User |
Action |
Args |
| 2015年04月29日 23:04:32 | siming85 | set | recipients:
+ siming85 |
| 2015年04月29日 23:04:32 | siming85 | set | messageid: <1430348672.59.0.934013457033.issue24078@psf.upfronthosting.co.za> |
| 2015年04月29日 23:04:32 | siming85 | link | issue24078 messages |
| 2015年04月29日 23:04:32 | siming85 | create |
|