Strongly typed list

هاني الموصلي hani.mousli at gmail.com
Mon Aug 17 22:47:44 CEST 2009


Hello, 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?
Perhaps of there is some thing like C# List<AutomataBranch>
cfgAutomata such that the list wont accept items unless they are
AutomataBranch will be good.



More information about the Python-list mailing list