https://pantsbuild.org/ logo
#general
Title
# general
h

hundreds-breakfast-49010

09/18/2019, 6:27 PM
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

aloof-angle-91616

09/18/2019, 6:28 PM
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

hundreds-breakfast-49010

09/18/2019, 6:30 PM
as long as we explicitly import
dataclass
it's fine to use anywhere in python code, right?
a

aloof-angle-91616

09/18/2019, 6:31 PM
yes, and make sure to depend on
3rdparty/python:dataclass
in any BUILD file
👍 2
until we move to 3.7
6 Views