Getting automatic completion using Eclipse + PyDev for function arguments

I use Eclipse and PyDev with Iron Python on a computer running Windows XP. I have a class definition that takes an object as an argument, which itself is an instance of another class as follows:

myObject1 = MyClass1()
myObject2 = MyClass2(myObject1)

The definitions of the two classes are in different modules: myclass1.py and myclass2.py, and I hoped that I would be able to automatically complete work on myObject1 when it is used in myclass2. In other words, in myclass2.py, I may have something like this:

""" myclass2.py """
class MyClass2():
    def __init__(self, myObject1):
        self.myObject1 = myObject1
        self.myObject1.  <============== would like auto code completion here

Can this work be done?

Thank!

+3
source share
3 answers

Jython PyDev/Eclipse, . MyClass1, - MyClass2, API. , , " ", Eclipse , - , .

:

>>> class a:
...     def b(self):
...         print('b')
...
>>> anA = a()
>>> anA.b()
b
>>> del a.b
>>> anA.b()
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
AttributeError: a instance has no attribute 'b'

, b() , .

,

>>> class a:
...     pass
...
>>> anA = a()
>>> anA.b()
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
AttributeError: a instance has no attribute 'b'
>>> def b(self):
...     print('b')
...
>>> a.b = b
>>> anA.b()
b

, , b(), .

, , .:)

+1

- (if False ...) , Pydev 2.5.

""" myclass2.py """
    class MyClass2():
    def __init__(self, myObject1):
        if False : myObject1 = MyClass1()
        self.myObject1 = myObject1        
        self.myObject1.  <============== would like auto code completion here
+1

__init__.py ? , , Python , , , .

0

Source: https://habr.com/ru/post/1752545/


All Articles