Hint PyDev for the type of property

Anonymous
2011-02-27
2013-03-15
  • Anonymous - 2011-02-27

    Is there a way to hint PyDev what is the type a variable (or property) so it can provide autocompletion?

    class C(object):
        def __init__(self, p):
            self.p = p #@type self.p: module.AnotherClass
       
        def m(self):
            self.p. # autocompletion for AnotherClass opens
    

    Regards,
    Emil

     
  • Fabio Zadrozny

    Fabio Zadrozny - 2011-02-28

    You can use an isinstance assert to check it…
    E.g.: assert isinstance(p, module.AnotherClass)

    but it won't work for your use-case (pydev will be able to resolve p in the same scope where the isinstance was used, but can't 'see' that self.p was of the same type that p (which had the assert used).

    Please add a feature request for that.

    Cheers,

    Fabio

     

Get latest updates about Open Source Projects, Conferences and News.

Sign up for the SourceForge newsletter:





No, thanks