将re.Pattern的类型专门化为re.Pattern[bytes],mypy正确地检测类型错误:REGEX: re.Pattern[bytes] = re.compile(b"main.py
/home/oren/main.py:5: error: Argument 1 to "fullmatch" of "Pattern" has incompatible type "str"; exp
review_without_punctuation = products['review'].apply(remove_punctuation)
这里的产品是pandas数据格式。这是我得到的错误信息。/3.6.0/Frameworks/Python.framework/Versions/3.6/lib/python3.6/re.py in sub(pattern, repl, string, countthe match