I am using eclips for python and i am facing a problem. I have many classes with many properties and want a list of objects from one of my declared classes. The problem is:When i am accessing any item from the list, the IDE does not know it's type because in python we do not declare the variable with it's type, so there is no auto complete and i have to go to the class to copy the attribute name. To make idea more clear:
class AutomataBranch(object): def __init__(selfparams): self.Name=""; self.nodes=; class LanguageAutomata(object): def __init__(selfparams): self.cfgAutomata=;#This has AutomaBranch Type
Now in any method in LanguageAutomata class if i wrote:
cfgAutomata. Then it wont give me the Name attribute Is there any solution for that?
You shouldn't be writing code to suit your IDE - the IDE is supposed to support you. If you're having trouble with it, then switch. There are plenty of editors that deal with Python properly.
Python is strongly typed and Python lists are too. Your problem come from the fact that Python is dynamically typed. Therefor a var can contain any type, and therefor no IDE can guess what is the type of your parameter, nor give you code completion for the methods.
This is how it is, there is no clean workaround. If it's a problem, then maybe dynamics language is not you predilection tool and you should use something that fit your development style. There are tools for everybody.
I think you mean to say "statically typed" instead of "strongly typed." Python is strongly typed. You just don't know what that type is at compile time.
With that said, you really need to abandon the idea that you're going to find any IDEs that work as well for Python as they do for Java or C#. Python's dynamic typing makes this difficult. In fact, I tend to find that powerful IDEs are more of a burden than a help.
I think I found a good managable solution. Actually it is trivial but may help (I used it now). When I want to access the list then I assign the object which I want to access to a variable ex:
x = AutomataBranch()
x = self.cfgAutomata[i]
The first line is used only to make the IDE knows that
x is from
AutomatBranch type. After that when I press
x then all methods and properties are visualized.
I think it is some how good.