简体   繁体   English

使用键入和分配错误值时不显示警告/通知/错误

[英]No warnings/notification/errors displayed when using typing and assigning wrong values

I'm new to python and i know that types can't be enforced and the maximum we can do is provide "warnings" . 我是python的新手,我知道无法强制执行类型,我们可以做的最大事情就是提供“ warnings”。 So i'm using typing with python3.7 with pycharm professional. 所以我用typing与pycharm专业python3.7。 But i don't get any warning, notification or indication that i'm using the wrong types. 但是我没有收到任何警告,通知或表明我使用了错误类型的指示。 Example: 例:

from typing import List

class MyClass:

__event_ids: List[str]

def __init__(self):

    self.__event_ids = 15 <---- This don't react in any way

    return

I've researched it, but no tutorial stated any additional steps i need to take to make it work properly 我已经对其进行了研究,但是没有教程说明需要采取任何其他步骤才能使其正常运行

试试mypy ,一个独立的类型检查器。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM