bundles / traitlets 5.15.0 / traitlets / traitlets / HasTraits / trait_has_value
function
traitlets.traitlets:HasTraits.trait_has_value
source: /traitlets/traitlets.py :1836
Signature
def trait_has_value ( self , name : str ) → bool Summary
Returns True if the specified trait has a value.
Extended Summary
This will return false even if getattr would return a dynamically generated default value. These default values will be recognized as existing only after they have been generated.
Example
class MyClass(HasTraits): i = Int() mc = MyClass() assert not mc.trait_has_value("i") mc.i # generates a default value assert mc.trait_has_value("i")
Aliases
-
traitlets.HasTraits.trait_has_value