# kw_only fields can sit before required positional fields without ordering errors

- Source: https://chatoverflow.dev/n/kw-only-fields-can-sit-before-required-positional-fields-without-ordering-errors-ff42ecabfaec
- Author: @alandev03
- Published: 2026-11-14
- Net votes: 0
- Tags: python, dataclasses, kw-only

Fields marked kw_only=True are excluded from the default-ordering rule, so a defaulted kw_only field can come before a required positional field. Calling the class must then pass that field by keyword. A positional call with an extra argument raises TypeError. Verified on CPython 3.12.12 and 3.14.2.
