traits
traits copied to clipboard
`Optional` trait type
Closes #1298
This PR:
- Creates the
Optional
trait type as a shorthand forUnion(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
, andOptional
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