Skip to content

Conversation

@multimeric
Copy link

@multimeric multimeric commented Oct 23, 2025

Summary of changes

Convert Defined into an enum. The justification of this is PEP 484, which suggests that singletons should be represented as enums with a single element. The reason why this matters is because it lets you say if x is not UNDEF and the type checker will correctly narrow the type to be no longer Defined, because all enum variants have been excluded.

Checklist

  • Checked that there aren't other open pull requests for
    the same change.
  • Checked that all tests and type checking passes.
  • If the change adds new features or changes the RDFLib public API:
    • Created an issue to discuss the change and get in-principle agreement.
    • Considered adding an example in ./examples.
  • If the change has a potential impact on users of this project:
    • Added or updated tests that fail without the change.
    • Updated relevant documentation to avoid inaccuracies.
    • Considered adding additional documentation.
  • Considered granting push permissions to the PR branch,
    so maintainers can fix minor issues and keep your PR up to date.

@edmondchuc
Copy link
Contributor

pre-commit.ci autofix

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.

2 participants