Skip to content

Completion does not work for custom __getitem__ and __getattr__ #774

Open
@zokrezyl

Description

@zokrezyl

Hi,

While bpython makes prototyping much easier, I bumped into a bit annoying limitation.
Given the following trivial example I would expect to have a completion working after 'a[0].' . I bumped into this in a must more complex situation.

                                                                                                                            
    def __getitem__(self, name):                                                                                             
        return self                                                                                                          
                                                                                                                             
    def __getattr__(self, name):                                                                                             
        return self                                                                                                          
                                                                                                                             
    def __dir__(self):                                                                                                       
        return ["a", "b"]                                                                                                    
                                                                                                                             
                                                                                                                             
a = A()```


any hints?

Thanks a lot

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions