-
Notifications
You must be signed in to change notification settings - Fork 51
Open
Milestone
Description
Summary
The Yaku class currently defines name as Optional[str].
The only place where name is directly referenced in the library is the Yaku.__str__() method, which returns self.name and therefore fails when name is None.
This issue discusses whether name should be made a required field.
Motivation
Yaku.__str__()assumesnameis always a string- Making
namerequired would prevent unexpectedNoneerrors - All built‑in Yaku subclasses already set
nameinsideset_attributes()
Discussion points
- Should
namebe required at the type level (strinstead ofOptional[str])? - If not required, should
Yaku.__str__()provide a safe fallback (e.g., empty string or class name)? - Are there use cases for a nameless Yaku?
Breaking changes
If name becomes required, the following cases will break:
- Instantiating a Yaku subclass without defining
name - Assigning
name = Noneafter instantiation
Metadata
Metadata
Assignees
Labels
No labels