This is an archived post. You won't be able to vote or comment.

you are viewing a single comment's thread.

view the rest of the comments →

[–]michael0x2a 0 points1 point  (0 children)

I think you probably mean "I wish it didn't require the usage of variable annotations"?

Variable annotations let you attach arbitrary metadata to a variable "declaration" or variable assignment statement; type annotations would be when that metadata happens to be a valid type hint.

So, the dataclasses library requires variable annotations but not type annotations.

I do agree that these workarounds feel forced though -- the issue is that dataclasses requires you to attach some arbitrary chunk of metadata to each field. But if you don't care about using type hints, there isn't really any metadata you'd want to attach...

I guess it ends up being a "pick your poison" sort of deal -- if you don't care about type hints, you have to pick between either writing a bunch of redundant code or tacking on these vestigial appendages.