Clarify difference between List(SomeClass) and List(Instance(SomeClass))
- Dominant language
- Python
- Stars
- 462
- Forks
- 90
- PR merge metrics
- No merged PRs in 30d
Description
This is a common point of confusion for newcomers: if `A` is a `HasTraits` subclass, then a trait whose value is a list of instances of `A` can be defined as `foo = List(A)` or as `foo = List(Instance(A))`.
We've investigated before, and found subtle differences between the two forms. The latter is more conceptually correct (the first argument to `List` should be a trait type), and in general is the recommended form in new code.
It would be good to do some or all of:
- document the difference between `List(A)` and `List(Instance(A))`
- if possible, see whether that difference can be eliminated (probably not)
- document the preferred form
- possibly even deprecate the non-preferred form, though this would affect a _lot_ of code, so the deprecation period would need to be correspondingly long.
Contributor guide
No contributing guide indexed for this repository
Assessment
This issue has not been assessed yet.