BUG? : protected members of superclass >initially< don't show up in suggestions for self in subclass
When accessing a private name of a superclass inside the subclass via "self", the name does initially not show up in the autocompletion list.
If you start typing it anyway, it still does not appear.
If you type the first few characters of the protected name, then delete and retype one or simply move the caret one char to the left and back, it suddenly appears in the suggestion list.
It seems like protected names from a superclass are not included in the suggestion list that appears after typing "self." (or similar),
but they do appear in the completion list that appears if you continue typing an existing member access.
(That is, whenever you place the cursor to the right of a pre-existing dot of a member access)
If you type it manually, it does not even produce a weak warning, as the "Accessing a protected member of a class or a module" inspection specificly states that accesses (to protected members) from within a decendant of the class is valid.
This inspection's behaviour is consistent with PEP8 and common python conventions.
So i think that the protected member of a superclass should also appear in the initial suggestion list of a member access.
Code Sample:
class A:
def _aprotected(self):
pass
def public(self):
pass
class B:
def _bprotected(self):
pass
def test(self):
// this shows up in suggestions and works fine
self.public()
// these show up as well
self._bprotected
super()._aprotected()
// this however does not show up in suggestions initially
// but if you start to type it (e.g. "self._pro") then delete the last char and retype it
// or simply move the cursor one char to the left and back and then continue to type
// it suddenly appears as autocompletion suggestion
self._protected()
Please sign in to leave a comment.