我正在使用eclips for python,并且我正面临一个问题。我有很多具有许多属性的类,并且需要我的一个声明类中的对象列表。问题是:当我访问列表中的任何项目时,IDE不知道它的类型,因为在python中我们没有声明变量的类型,所以没有自动完成,我必须去类复制属性名称。 为了让想法更加清晰:Python强类型列表
class AutomataBranch(object):
def __init__(selfparams):
self.Name="";
self.nodes=[];
class LanguageAutomata(object):
def __init__(selfparams):
self.cfgAutomata=[];#This has AutomaBranch Type
现在在LanguageAutomata类中的任何方法,如果我写道: cfgAutomata
。然后它不会给我名称属性 有没有解决方案?
你在使用PyDev吗? http://pydev.sourceforge.net/ – mcandre 2009-08-17 14:57:31
self.cfgAutomata有一个列表类型。你是否真的试图获得self.cfgAutomata类型[]? –
2009-08-17 15:15:56
这里有一个错字,对不对?在_ \ _ _ _ _ _ _ _ _ _ _ _ _ _ _中初始化一个逗号def __init __(self,params): – hughdbrown 2009-08-17 15:20:10