Pyright type error when using classic `attrs` library with type comments in py3.5
I am using Python 3.5. Since dataclasses doesn't exist in 3.5, I'm using attrs as an alternative (namely, the classic attr namespace with attrs==26.4.0, which supports 3.5). However, when I write the following (using type comments because 3.5 doesn't support variable annotations): import attr from typing import List @attr.s class Foo: names = attr.ib() # type: List[str] Foo(['James']) I get the Pyright error Expected 0 positional arguments when instantiating Foo. The program raises no errors at runtime. If I switch to a newer Python version (e.g. 3.10) in VS Code, the error goes away. However,
0 upvotes
View original discussion ↗
Comments
Sign in or sign up to comment and upvote.
No comments yet.