Message148375
| Author |
pitrou |
| Recipients |
eric.araujo, ncoghlan, pitrou, python-dev, sbt, vstinner |
| Date |
2011年11月26日.00:31:01 |
| SpamBayes Score |
2.8161756e-07 |
| Marked as misclassified |
No |
| Message-id |
<1322267163.3272.45.camel@localhost.localdomain> |
| In-reply-to |
<1322265131.5.0.631848129099.issue13448@psf.upfronthosting.co.za> |
| Content |
> There are some callables which are missing __qualname__:
>
> method_descriptor
> wrapper_descriptor
> builtin_function_or_method
>
> For the descriptors, at least, obj.__qualname__ should be equivalent to
>
> obj.__objclass__.__qualname__ + '.' + obj.__name__
>
> Were these overlooked?
Indeed, they were overlooked. Due to the way they are instantiated,
though, it would be quite a bit harder to devise a __qualname__ for
them.
> Also I notice that bound methods have a misleading __qualname__:
>
> >>> class A:
> ... def f(self): pass
> ...
> [66348 refs]
> >>> A().f.__qualname__
> 'A.f'
>
> Maybe this should be 'A().f' instead.
I am a bit surprised that this works at all. Apparently attribute
lookups are redirected to the underlying function. |
|