【发布时间】:2014-10-17 05:25:45
【问题描述】:
我在athleteModel.py 脚本中有@property 注释的方法:
@property
def get_from_store():
with open(athleteFilePath,'rb') as pickleFile:
athleteMap = pickle.load(pickleFile)
print('Loaded athleteMap ',athleteMap)
return athleteMap
我在另一个脚本中使用了这个方法:
from athleteModel import get_from_store
athletes = get_from_store
print(yate.u_list(athletes[athName].sortedTimes))
在最后一行(print 方法)我得到异常:
TypeError: 'function' object is not subscriptable
args = ("'function' object is not subscriptable",)
with_traceback = <built-in method with_traceback of TypeError object>
我的代码有什么问题?
【问题讨论】:
-
我以为是python而不是我生成的
标签: python python-3.x properties decorator python-decorators