Python 3.5 Typing ABCMeta does not define '__getitem__'

匿名 (未验证) 提交于 2019-12-03 08:52:47

问题:

I am trying out Python 3.5's typing module by marking up a few of my functions.

I have a function that returns a list though I am getting a warning in PyCharm.

The warning reads:

Class 'ABCMeta' does not define '__getitem__', so the '[]' operator cannot be used on its instances

from typing import List  def get_list() -> List[int]:     return [1, 2, 3] 

Is anyone able to better interpret that message then I can?

Thanks

回答1:

Was a bug in PyCharm. Resolved in 5.0.3. REF: https://youtrack.jetbrains.com/issueMobile/PY-17841



标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!