• Tim Peters's avatar
    Make dir() wordier (see the new docstring). The new behavior is a mixed · 5d2b77cf
    Tim Peters yazdı
    bag.  It's clearly wrong for classic classes, at heart because a classic
    class doesn't have a __class__ attribute, and I'm unclear on whether
    that's feature or bug.  I'll repair this once I find out (in the
    meantime, dir() applied to classic classes won't find the base classes,
    while dir() applied to a classic-class instance *will* find the base
    classes but not *their* base classes).
    
    Please give the new dir() a try and see whether you love it or hate it.
    The new dir([]) behavior is something I could come to love.  Here's
    something to hate:
    
    >>> class C:
    ...     pass
    ...
    >>> c = C()
    >>> dir(c)
    ['__doc__', '__module__']
    >>>
    
    The idea that an instance has a __doc__ attribute is jarring (of course
    it's really c.__class__.__doc__ == C.__doc__; likewise for __module__).
    
    OTOH, the code already has too many special cases, and dir(x) doesn't
    have a compelling or clear purpose when x isn't a module.
    5d2b77cf
Adı
Son kayıt (commit)
Son güncelleme
Demo Loading commit data...
Doc Loading commit data...
Grammar Loading commit data...
Include Loading commit data...
Lib Loading commit data...
Mac Loading commit data...
Misc Loading commit data...
Modules Loading commit data...
Objects Loading commit data...
PC Loading commit data...
PCbuild Loading commit data...
Parser Loading commit data...
Python Loading commit data...
RISCOS Loading commit data...
Tools Loading commit data...
.cvsignore Loading commit data...
.hgtags Loading commit data...
LICENSE Loading commit data...
Makefile.pre.in Loading commit data...
PLAN.txt Loading commit data...
README Loading commit data...
acconfig.h Loading commit data...
configure Loading commit data...
configure.in Loading commit data...
install-sh Loading commit data...
pyconfig.h.in Loading commit data...
setup.py Loading commit data...