Skip to content

Remove empty_attribute_default; empty attributes always return '' #255

Closed

Description

@derek73

Summary

2.0 removes the empty_attribute_default config option entirely. Empty name attributes always return ''. Once None support goes (see below for why it must), the only legal value left is the default — a dial with one position isn't configuration.

History: why it exists

Added in v0.3.15 (2016, pre-1.0) for #44: a user wanted None instead of '' to store name components as database NULLs. The maintainer's first response was the one-liner that is now the migration path — "you could do it easily too with something like name.title or None" — and "I don't have a strong preference." Making None the universal return broke the formatting tests, so a config option was added as a compromise. The first consequence arrived in the same thread: str() produced 'None John None Doe None (None)', patched in PR #45 with a .replace(str(empty_attribute_default), '') scrub that is still in __str__ today.

What it has cost

What removal deletes

The or self.C.empty_attribute_default tail on all seven attribute properties plus surnames/given_names/last_base/last_prefixes and initials(); the __str__ scrub hack; the docs section; the test type: ignores.

Removal mechanics (both learned from the 1.3.0 guard work)

Migration

hn.first or None at the database boundary, or {k: v or None for k, v in name.as_dict().items()} for a whole record.

Bridge (1.4) — tracked in #263

Activity

  1. added this to the v2.0 milestone on Jul 6, 2026
  2. added
    breaking-change
    on Jul 6, 2026
  3. self-assigned this
    on Jul 6, 2026
  4. derek73 commented on Jul 11, 2026

    @derek73
    OwnerAuthor

    Note from the review of #277 (the 1.3.1 fix for #254): the fix changed str() behavior for custom truthy values of empty_attribute_default, an undocumented configuration (only '' and None are documented or tested).

    With empty_attribute_default = 'N/A':

    Decision was to leave this as-is rather than complicate the deprecation-window code, since this option is removed entirely here in 2.0. If anyone reports depending on a truthy default before then, the fix would be to key the __str__ substitution off actual field emptiness (the _list attributes) instead of value falsiness.

    🤖 Generated with Claude Code

  5. derek73 commented on Jul 28, 2026

    @derek73
    OwnerAuthor

    Shipped in 2.0.0. Delivery and release-log coverage were verified issue-by-issue in the pre-release milestone audit.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

breaking-changeenhancement

Type

No type

Projects

No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions