enthought / enthought/traits

Proposal: "Optional(Foo)" as a synonym for "Union(None, Foo)"

Open
#1,298 4 comments 1 reaction 0 assignees View on GitHub
easy good first issue priority: low type: discussion type: enhancement
Dominant language
Python
Stars
462
Forks
90
PR merge metrics
No merged PRs in 30d

Description

It is common to have `Union` traits of the form `Union(None, )`. As a convenience to developers, and following a similar convention in Python's `typing` module, we should consider having `Optional()` as an alternative way of writing `Union(None, )`.

An alternative would be to make `allow_none` metadata universally accepted across `TraitType` instances.

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.