预期类型' word' (匹配通用类型' _t;),got'反而
我正在研究一些堆栈对象,并遇到了一个奇怪的警告: 预期类型的“ word”(匹配的通用类型'_t'),获得“字符”,而是
初始化了一个具有堆栈的数据结构:
def __init__(self, text, actions):
self._stack = []
self._stack.append(Word())
然后我尝试将另一个对象插入堆栈中,但是我会出现此警告。
def act_s(self):
self._stack.append(Character())
为什么会发生这种情况? 据我所知,Python列表可以处理多个类型对象。 谢谢!
I'm working on some stack object and encountered a weird warning:
Expected type 'Word' (matched generic type '_T'), got 'Character' instead
I initialized a data struct that has a stack:
def __init__(self, text, actions):
self._stack = []
self._stack.append(Word())
And then I try to insert another object typed to the stack, but I have this warning appearing.
def act_s(self):
self._stack.append(Character())
Why is this happening?
Python lists can handle multiple type object as far as I know.
Thanks!
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论