Message148368
| Author |
sbt |
| Recipients |
eric.araujo, ncoghlan, pitrou, python-dev, sbt, vstinner |
| Date |
2011年11月25日.23:52:10 |
| SpamBayes Score |
2.5313849e-09 |
| Marked as misclassified |
No |
| Message-id |
<1322265131.5.0.631848129099.issue13448@psf.upfronthosting.co.za> |
| In-reply-to |
| 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?
PS C:\Repos\cpython> .\PCbuild\python_d
Python 3.3.0a0 (default, Nov 25 2011, 22:14:28) [MSC v.1500 32 bit (Intel)] on win32
Type "help", "copyright", "credits" or "license" for more information.
>>> import pickle
[66213 refs]
>>> attribs = ('__class__', '__name__', '__qualname__')
[66220 refs]
>>> for o in (pickle.Pickler, pickle.Pickler.dump, object.__init__, min):
... print([getattr(o, a, None) for a in attribs])
...
[<class 'type'>, 'Pickler', 'Pickler']
[<class 'method_descriptor'>, 'dump', None]
[<class 'wrapper_descriptor'>, '__init__', None]
[<class 'builtin_function_or_method'>, 'min', None]
[66265 refs]
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. |
|