traits icon indicating copy to clipboard operation
traits copied to clipboard

`Optional` trait type

Open k2bd opened this issue 2 months ago • 4 comments

Closes #1298

This PR:

  • Creates the Optional trait type as a shorthand for Union(None, ...)
  • Changes exception messages in Union to refer to subclass names, e.g. Optional (let me know if this is controversial and I can change!)
  • Adds xfail tests for Constant, Union, and Optional demonstrating behaviour discussed in #1784, some of these may also be controversial and I can remove/alter them if so

Checklist

  • [x] Tests
  • [x] Update API reference (docs/source/traits_api_reference)
  • [x] Update User manual (docs/source/traits_user_manual)
  • [x] Update type annotation hints in stub files

k2bd avatar Apr 10 '24 18:04 k2bd