enthought / enthought/traits

Validate default value upon trait instantiation?

Open
#948 14 comments 0 reactions 0 assignees View on GitHub
type: discussion
Dominant language
Python
Stars
462
Forks
90
PR merge metrics
No merged PRs in 30d

Description

This came up a few times in the past (e.g. #886): Currently default value is not validated upon trait initialization, so one could do this
```
from traits.api import Int, HasTraits

class Foo(HasTraits):
age = Int("ABC")

>>> f = Foo()
>>> f.age
"ABC"
```

This issue is for discussing whether or not we should validate default values for all the traits when the trait is instantiated (and inevitably the "how" if we do).

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.