I think stack inspection could be avoided if we did something like:
```
@dataclasses.dataclass
class Parent:
class pos(dataclasses.PositionalOnly):
a: int
c: bool = False
class kw(dataclasses.KeywordOnly):
e: list
```
Like your proposal, the names for the two inner classes can be anything, but they must be unique. The metaclass would check if a field in the new class's namespace was a subclass of PositionalOnly or KeywordOnly, and if so recurse into its annotations to collect more fields.
This still seems hacky, but it seems to read reasonably nicely, and behaves obviously in the presence of subclassing.