general python question: when we define a `datatyp...
# general
h
general python question: when we define a
datatype
with tuples of
("field_name", type_specifier)
, what's the best way to make some of those fields have defaults?
a
in general, using
@dataclass
lets you get pretty much everything you'd expect from
datatype()
-- https://github.com/pantsbuild/pants/pull/6374/files has been lying in wait for a while, and can probably be abandoned
h
as long as we explicitly import
dataclass
it's fine to use anywhere in python code, right?
a
yes, and make sure to depend on
3rdparty/python:dataclass
in any BUILD file
👍 2
until we move to 3.7