[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Strange tab completion oddity with enums?

Chris Angelico wrote:

>> Looks like everything starting with an underscore (except class, doc, and
>> module) is suppressed, probably to suppress some noise...
> That's why dir() shows what it does, but tab completion seems to have
> some other source, as it's able to find a lot of other attributes but
> not __annotations__. Very strange.

If I'm reading rlcompleter.py correctly 

        words = set(dir(thisobject))

        if hasattr(thisobject, '__class__'):

def get_class_members(klass):
    ret = dir(klass)
    if hasattr(klass,'__bases__'):
        for base in klass.__bases__:
            ret = ret + get_class_members(base)
    return ret

it implements its own way to walk the class tree, and type being the base 
class of EnumMeta those additional attributes should be the result of