Open adrianmgg opened 2 years ago
It would be nice to have an annotation specifically to make Tap ignore variables, e.g., @tap_ignore
. Since ClassVar
would be less common, asking users to use both might be sufficient. My use case is that I have a complex type that I create from multiple arguments in process_args
(right now, I just say not to use it in the comment).
class ArgParser(Tap):
params: List[float] = []
""" Even number of entries. Each pair is the mean and
standard deviation of the Gaussian underlying a
log-normal distribution """
@tap_ignore
distributions: List[LogNormal] = []
""" process_args will construct this from params after
checking params for validity """
Hi @adrianmgg and @RadixSeven,
We like both of these ideas! Thank you so much for bringing up this issue. We'll try to get to this soon, but any PRs are welcome and appreciated.
Thanks, Kyle and Jesse
ClassVar
is (quoting from here in typing docs, emphasis mine):I think it would make sense to exclude any variables whose annotations are wrapped in
ClassVar
from the list of arguments.