Skip to content

Add DefaultPlaceholder and is_placeholder_default; InstanceAttrDefault is one - #121

Merged
thorwhalen merged 1 commit into
masterfrom
120-placeholder-default
Oct 20, 2026
Merged

thorwhalen merged 1 commit into
masterfrom
120-placeholder-default

Conversation

@thorwhalen

Copy link
Copy Markdown
Member

Closes #120

A methodize(..., default_from=...) param's signature default is an InstanceAttrDefault marker (self.attr), not a value: its value depends on the instance, which a form or schema generator does not have. Decision: no serialization hook; consumers treat it as "no default", exactly as they treat NotSet.

  • i2.DefaultPlaceholder: base class for signature defaults that stand for a value rather than being one. InstanceAttrDefault subclasses it.
  • i2.is_placeholder_default(x): NotSet or a DefaultPlaceholder; the one predicate consumers need.
  • Test: a JSON dump of a methodized function's Sig(...).defaults fails raw and succeeds with placeholders skipped.

Additive only; is_not_set is unchanged. Consumers switch in follow-ups (front, py2http).

🤖 Generated with Claude Code

…t is one

A methodize(default_from=...) signature default is an InstanceAttrDefault marker,
not a value. Consumers that serialize signature defaults (front forms, py2http
OpenAPI) should skip it as they skip NotSet; is_placeholder_default is the one
predicate for both. Test: a JSON dump of a methodized function's Sig defaults.

Closes #120

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@thorwhalen
thorwhalen merged commit ff0e925 into master Oct 20, 2026
12 checks passed
@thorwhalen
thorwhalen deleted the 120-placeholder-default branch October 20, 2026 18:24
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Check how front / py2http serialize an InstanceAttrDefault signature default (methodize default_from)

1 participant