Menu

#115 More completions for self.<tab>

open
nobody
None
5
2006-04-18
2006-04-18
Dobes V
No

It would be great if self.<tab> would complete:

1. fields defined in __slots__ for the class
2. method parameters, while in the __init__ method.

Discussion

  • Fabio Zadrozny

    Fabio Zadrozny - 2006-04-18
    • status: open --> pending
     
  • Dobes V

    Dobes V - 2006-04-18
    • status: pending --> open
     
  • Dobes V

    Dobes V - 2006-04-18

    Logged In: YES
    user_id=400635

    1.

    class X1:
    __slots__ = ('a', 'b', 'c')
    def anymethod(self):
    self.<complete:a,b,or c>

    2.

    class X2:
    def __init__(self, a, b, c)
    self.a = a
    self.<complete:a,b,or c>

    This is handy because it helps avoid typing the member
    names over and over - once for slots, once for the init
    parameters, and once for the assignment.

     
  • Fabio Zadrozny

    Fabio Zadrozny - 2006-04-18

    Logged In: YES
    user_id=617340

    Ok, fair enough... Actually, it already does something like
    that as:

    class X1:
    properties.create(a = 10, b = 20)

    Because I had that as a previous request... So, shouldn't be
    hard to extend it.

    The only thing is that I didn't get the example2
    correctly... Did you mean that X2 is a subclass of X1?

     
  • Fabio Zadrozny

    Fabio Zadrozny - 2006-04-18
    • status: open --> pending
     
  • Dobes V

    Dobes V - 2006-04-18

    Logged In: YES
    user_id=400635

    2 isn't a "correct" completion, just a handy one, to
    pretend that all the parameters to __init__ will be made
    into member variables of the same name in __init__.
    Probably if you add it, it should be an option to turn it
    on or off.

    So, no - X2 isn't a subclass of X1.

    really it's for a case like:

    class A:
    def __init__(self, someReallLongMemberName=None):
    self.some<complete> = some<complete>

    so that you can just type the name once and complete it
    twice.

     
  • Dobes V

    Dobes V - 2006-04-18
    • status: pending --> open
     
  • Fabio Zadrozny

    Fabio Zadrozny - 2006-04-18

    Logged In: YES
    user_id=617340

    Well, if you take a look at the pydev-code list you'll see
    that there is a script that will do what you want in that
    case, that is putting the parameters as attributes for a
    method, so, with that, the code-completion proposed does not
    seem like a good solution to me...

    Cheers,

    Fabio

     
Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.