google-deepmind / google-deepmind/chex

TypeError: non-default argument 'value' follows default argument

Open
#305 1 comment 0 reactions 0 assignees View on GitHub
Dominant language
Python
Stars
957
Forks
74
Avg merge
21h 10m
Merged PRs (30d)
1

Description

I'm trying to inherit from a dataclass with an optional id in the parent, however, I am seeing `TypeError: non-default argument 'value' follows default argument`. This is the minimal code to reproduce.
```
from typing import Optional
import chex

@chex.dataclass
class Base:
idx: Optional[int] = None

@chex.dataclass
class Derived(Base):
value: int
```
This is an issue with the `dataclasses` library rather than `chex.dataclasses`, however, according to https://stackoverflow.com/questions/51575931/class-inheritance-in-python-3-7-dataclasses#answer-69822584, it is possible to fix by setting `kw_only=True`.

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.