You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
fromtraits.apiimportCStr, ReadOnlyfromtraits.apiimportHasTraitsclassFoo(HasTraits):
attr_01=ReadOnly(value_type=CStr)
foo=Foo(attr_01=123) # <--- This does not result in `CStr` value today...print("attr_01 Type:", type(foo.attr_01))
print("attr_01 Value:", foo.attr_01)
Running this:
attr_01 Type: <class 'int'>
attr_01 Value: 123
Is there a way to achieve ReadOnly with a value_type today?
The text was updated successfully, but these errors were encountered:
I'm afraid there isn't, at the moment. There's a PR open along those lines, though: #488. Would the feature described in that PR work for you, or were you looking for something different?
Is there a way to enforce
ReadOnly
trait type?For example, I need something like this...
Running this:
Is there a way to achieve
ReadOnly
with avalue_type
today?The text was updated successfully, but these errors were encountered: