Menu

#535 ignore method/attributes from object class

open
nobody
None
5
2011-06-02
2011-05-09
greg_allen
No

when following the PEP8 convention of leading underscores for "protected" and "private" methods, Ctrl-Space code completion becomes almost useless due to being overcrowded with builitin and inherited methods like __str__.

It would be good if there was a way to ignore these __ *suffixed* names, or better, demote them to a second tier of completions, similar to the JDE approach.

Discussion

  • greg_allen

    greg_allen - 2011-06-01

    alternatively, provide a reference to order the offered completions - i.e. rank method/attribute matches according to depth of inheritance

     
  • greg_allen

    greg_allen - 2011-06-01

    *preference

     
  • Fabio Zadrozny

    Fabio Zadrozny - 2011-06-01

    Actually, in PyDev 2.1.0, the sorting is already done, so, completions with '_' and '__' will have lower priorities... is that enough?

     
  • Fabio Zadrozny

    Fabio Zadrozny - 2011-06-01
    • status: open --> pending
     
  • greg_allen

    greg_allen - 2011-06-01
    • status: pending --> open
     
  • greg_allen

    greg_allen - 2011-06-01

    not really - in this case I am using _ for "protected" and __ for "private" methods, as per standard python conventions. So when I hit type self._ <Ctrl+Space> I want to see protected methods before all the __*___ builtins and object methods. Or, at worst, I would like to see the local methods before builtins.

    Just tried this in Pydev 2.1.0, and it seems to sort by name only, though the nice icons are there to show which is which

     
  • Fabio Zadrozny

    Fabio Zadrozny - 2011-06-02
    • status: open --> pending
     
  • Fabio Zadrozny

    Fabio Zadrozny - 2011-06-02

    Just to confirm, the current order just considers '_' and '__', and you'd like it to consider '_', '__' and '__*__', is that it?

     
  • greg_allen

    greg_allen - 2011-06-02

    yes- if the __*__ names could be pulled out and pushed to the bottom of the sort order, that would good. And as you say, single _ prefixes should rank higher that double __ prefixes (only happens when you assist on a single _ character of course)

    In short:

    _[^_].* < __.*[^_] < __.*__

     
  • greg_allen

    greg_allen - 2011-06-02
    • status: pending --> open