A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://github.com/ericvsmith/dataclasses/issues/14 below:

Annotated class variables · Issue #14 · ericvsmith/dataclasses · GitHub

Is there a simple way to avoid including annotated (for the purpose of static checking) class variable into the list of fields? Ideally, it could be possible to just write:

@easy
class C:
    x: int
    inst_count: ClassVar[int] = 0

Possible solution would be to just use a special marker for exclusion:

@easy
class C:
    x: int
    inst_count: ClassVar[int] = classvar(0)  # Just inserts 0 here in generated code

I don't like re-using field here, since inst_count is not actually a field.


RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4